Skip to content

Commit 4309423

Browse files
committed
Removes useless model part and adds copyright to the issue test file
1 parent 69c06c9 commit 4309423

File tree

1 file changed

+6
-88
lines changed

1 file changed

+6
-88
lines changed

Orm/Xtensive.Orm.Tests/Upgrade/UpgradeToNewHierarchyThatInheritsStructureTest.cs

Lines changed: 6 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1+
// Copyright (C) 2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
4+
15
using System;
26
using System.Collections.Generic;
37
using System.Linq;
48
using System.Text;
59
using System.Threading.Tasks;
610
using NUnit.Framework;
711
using Xtensive.Core;
12+
using Xtensive.Collections;
813
using Xtensive.Modelling.Actions;
914
using Xtensive.Modelling.Comparison;
1015
using Xtensive.Orm.Configuration;
1116
using Xtensive.Orm.Model;
1217
using Xtensive.Orm.Services;
18+
using Xtensive.Orm.Upgrade;
1319
using OneToOneStructure = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.OneToOneStructure;
1420
using NewColumnWithinTable = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.NewColumnWithinTable;
1521
using RemoveColumnWithinTable = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.RemoveColumnWithinTable;
1622
using NewTable = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.NewTable;
1723
using RemoveTable = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.RemoveTable;
1824

19-
using ConnectorType = Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel.ConnectorType;
20-
using Xtensive.Orm.Upgrade;
21-
using Xtensive.Collections;
22-
2325
namespace Xtensive.Orm.Tests.Upgrade
2426
{
2527
[TestFixture]
@@ -753,90 +755,6 @@ private bool CheckExistance(TypeInfo rootType, Session session)
753755

754756
namespace Xtensive.Orm.Tests.Upgrade.UpgradeToNewHierarchyThatInheritsStructureTestModel
755757
{
756-
namespace ConnectorType
757-
{
758-
namespace Before
759-
{
760-
[HierarchyRoot]
761-
public class Author : Entity
762-
{
763-
[Field, Key]
764-
public int Id { get; private set; }
765-
766-
[Field]
767-
public string Name { get; set; }
768-
769-
[Field]
770-
[Association(PairTo = nameof(Book.Authors))]
771-
public EntitySet<Book> Books { get; private set; }
772-
}
773-
774-
[HierarchyRoot]
775-
public class Book : Entity
776-
{
777-
[Field, Key]
778-
public int Id { get; private set; }
779-
780-
[Field]
781-
public string Name { get; set; }
782-
783-
[Field]
784-
public EntitySet<Author> Authors { get; private set; }
785-
}
786-
}
787-
788-
namespace After
789-
{
790-
[HierarchyRoot]
791-
public class Author : Entity
792-
{
793-
[Field, Key]
794-
public int Id { get; private set; }
795-
796-
[Field]
797-
public string Name { get; set; }
798-
799-
[Field]
800-
[Association(PairTo = nameof(Book.Authors))]
801-
public EntitySet<Book> Books { get; private set; }
802-
}
803-
804-
[HierarchyRoot]
805-
[Index(nameof(NewUniqueName), Unique = true)]
806-
public class Book : Entity
807-
{
808-
[Field, Key]
809-
public int Id { get; private set; }
810-
811-
[Field]
812-
public string Name { get; set; }
813-
814-
[Field]
815-
public string NewUniqueName { get; set; }
816-
817-
[Field]
818-
public EntitySet<Author> Authors { get; private set; }
819-
}
820-
821-
public class CustomUpgradeHandler : UpgradeHandler
822-
{
823-
public override bool CanUpgradeFrom(string oldVersion) => true;
824-
825-
public override void OnUpgrade()
826-
{
827-
base.OnUpgrade();
828-
829-
var session = UpgradeContext.Session;
830-
foreach (var item in session.Query.All<Book>()) {
831-
item.NewUniqueName = Guid.NewGuid().ToString();
832-
}
833-
session.SaveChanges();
834-
}
835-
}
836-
}
837-
}
838-
839-
840758
namespace OneToOneStructure
841759
{
842760
namespace Before

0 commit comments

Comments
 (0)