public class Foo
{
    [Recycled][HierarchyRoot]
    public class Bar : Entity
    {
        [Field][Key]
        public Guid Id { get; set; }
    }
}

class Program
{
    static void Main(string[] args)
    {
        var dc = new DomainConfiguration("sqlserver://localhost/DO40-Tests");
        dc.Types.Register(typeof(Foo.Bar));
        dc.UpgradeMode = DomainUpgradeMode.Recreate;

        using (var domain = Domain.Build(dc)){}

        dc = dc.Clone();
        dc.UpgradeMode = DomainUpgradeMode.PerformSafely;

        using (var domain = Domain.Build(dc)){}
    }
}

Second domain build fails with

System.InvalidOperationException was unhandled
  HResult=-2146233079
  Message=Type 'Nested.Bar' is not found.
  Source=Xtensive.Orm
  StackTrace:
       at Xtensive.Orm.Upgrade.HintGenerator.ValidateRenameTypeHints(IEnumerable`1 hints)
       at Xtensive.Orm.Upgrade.HintGenerator.ValidateHints(NativeTypeClassifier`1 hints)
       at Xtensive.Orm.Upgrade.HintGenerator.Run()
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.BuildSchemaHints(StorageModel extractedSchema)
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.GetSchemaHints(StorageModel extractedSchema, StorageModel targetSchema)
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.SynchronizeSchema(Domain domain, SchemaUpgrader upgrader, SchemaExtractor extractor, SchemaUpgradeMode schemaUpgradeMode)
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.PerformUpgrade(Domain domain, UpgradeStage stage)
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.BuildMultistageDomain()
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Run()
       at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
       at Xtensive.Orm.Domain.Build(DomainConfiguration configuration)
       at Nested.Program.Main(String[] args) in e:\Projects\PT\PerfomanceTest\PerfomanceTest\Program.cs:line 41
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

asked Feb 04 '14 at 04:28

pil0t's gravatar image

pil0t
207545763

Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA