google-code-export / dataobjectsdotnet

Automatically exported from code.google.com/p/dataobjectsdotnet
0 stars 0 forks source link

Upgrade fails if leaf type is extracted to a separate hierarchy #834

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Subj.

Old code:

public class ProductionServiceProvisionActService : SevRGasEntity {
  ...
}

New code:

[HierarchyRoot]
public class ProductionServiceProvisionActService : Entity {
  ...
}

Erro & stack trace: "Sequence contains no matching element"
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Xtensive.Storage.Upgrade.HintGenerator.GenerateTypeIdFieldRemoveHintsForConcreteTable()
   at Xtensive.Storage.Upgrade.HintGenerator.GenerateHints(IEnumerable`1 upgradeHints)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildSchemaHints(StorageInfo extractedSchema, StorageInfo targetSchema)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.<>c__DisplayClass7.<CreateBuilderConfiguration>b__3(StorageInfo extractedSchema, StorageInfo targetSchema)
   at Xtensive.Storage.Building.Builders.DomainBuilder.SynchronizeSchema(SchemaUpgradeMode schemaUpgradeMode)
   at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage)
   at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
   at Xtensive.Storage.Domain.Build(DomainConfiguration configuration)
   at Egs.Data.Common.DomainProvider.GetDomain() in D:\Work\DO\SevRGas\EGS\Data\Egs.Data\Common\DomainProvider.cs:line 30

Buggy code:

var typeIdField = type.Fields.Single(f => f.IsTypeId);
var targetType = typeMapping[type];
var targetTypeIdField = targetType.Fields.Single(f => f.IsTypeId);

Likely, the exception is thrown @ the last line.

Original issue reported on code.google.com by alex.yakunin on 18 Oct 2010 at 5:37

GoogleCodeExporter commented 9 years ago
Quite similar: issue 841

Original comment by alex.yakunin on 21 Oct 2010 at 1:38

GoogleCodeExporter commented 9 years ago
Done.

Original comment by alex.yakunin on 26 Oct 2010 at 10:34