protected override void  AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Issues.IssueJira0537_DropDefaultConstraintBugTestModel1.StoredObject", typeof(WMS.StoredObject)));
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Issues.IssueJira0537_DropDefaultConstraintBugTestModel1.Area", typeof(Core.Area)));
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Issues.IssueJira0537_DropDefaultConstraintBugTestModel1.AnotherStoredObject", typeof(WMS.AnotherStoredObject)));
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Issues.IssueJira0537_DropDefaultConstraintBugTestModel1.AnotherArea", typeof(Core.AnotherArea)));
     hints.Add(new ChangeFieldTypeHint(typeof(Core.AnotherArea), "NotEmpty"));
 }
Ejemplo n.º 2
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(typeof(ModelVersion1.A).FullName, typeof(ModelVersion2.A)));
     hints.Add(new RenameTypeHint(typeof(ModelVersion1.B).FullName, typeof(ModelVersion2.B)));
     hints.Add(new RenameTypeHint(typeof(ModelVersion1.X).FullName, typeof(ModelVersion2.X)));
     hints.Add(new MoveFieldHint(typeof(ModelVersion1.B).FullName, "Reference", typeof(ModelVersion2.A)));
     base.AddUpgradeHints(hints);
 }
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     _ = hints.Add(new RemoveTypeHint(typeof(V1.MyBaseClass).FullName));
     _ = hints.Add(new RenameTypeHint(typeof(V1.MyFirstClass).FullName, typeof(MyFirstClass)));
     _ = hints.Add(new RenameTypeHint(typeof(V1.MySecondClass).FullName, typeof(MySecondClass)));
     _ = hints.Add(new CopyFieldHint(typeof(V1.MyBaseClass), "StringValue", typeof(MyFirstClass)));
     _ = hints.Add(new CopyFieldHint(typeof(V1.MyBaseClass), "StringValue", typeof(MySecondClass)));
 }
Ejemplo n.º 4
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     if (runningVersion == "2")
     {
         Version1To2Hints.ForEach(hint => hints.Add(hint));
         hints.Add(new RenameFieldHint(typeof(M2.Person), "Friend", "NewFriend"));
     }
 }
Ejemplo n.º 5
0
        protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
        {
#pragma warning disable 612,618
            // var hints = GetTypeRenameHints("Version1", "Version2");
            hints.Add(new RenameTypeHint(typeof(M1.Base).FullName, typeof(M2.Base)));
            hints.Add(new RenameTypeHint(typeof(M1.Derived).FullName, typeof(M2.Derived)));
#pragma warning restore 612,618
        }
                protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
                {
                    var oldClientType    = typeof(Model1.Client).FullName;
                    var oldClientRefType = typeof(Model1.ClientRef).FullName;

                    hints.Add(RenameTypeHint.Create <Contractor>(oldClientType));
                    hints.Add(RenameTypeHint.Create <ClientRef>(oldClientRefType));
                }
Ejemplo n.º 7
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(
                   typeof(Version1.Namespace1.Renamed1).FullName,
                   typeof(Version2.Namespace2.Renamed1)));
     hints.Add(new RenameTypeHint(
                   typeof(Version1.Namespace2.Renamed2).FullName,
                   typeof(Version2.Namespace1.Renamed2)));
 }
Ejemplo n.º 8
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     if (runningVersion == "2")
     {
         Version1To2Hints.ForEach(hint => hints.Add(hint));
     }
 }
Ejemplo n.º 9
0
                protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
                {
                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.SingleTableDescendant12Removed"));
                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.SingleTableDescendant22Removed"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.SingleTableDescendant12Removed", "SingleTableD12Field"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.SingleTableDescendant22Removed", "SingleTableD22Field"));

                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.ClassTableDescendant12Removed"));
                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.ClassTableDescendant22Removed"));

                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.ConcreteTableDescendant12Removed"));
                    hints.Add(new RemoveTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveTypeModel.ConcreteTableDescendant22Removed"));
                }
Ejemplo n.º 10
0
                protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
                {
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.SingleTableHierarchyBase", "SingleTableRemovableField"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.ConcreteTableHierarchyBase", "ConcreteTableRemovableField"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.ClassTableHierarchyBase", "ClassTableRemovableField"));

                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.SingleTableDescendant", "SomeDescendantRemovableField"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.ConcreteTableDescendant", "SomeDescendantRemovableField"));
                    hints.Add(new RemoveFieldHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RemoveFieldModel.ClassTableDescendant", "SomeDescendantRemovableField"));
                }
Ejemplo n.º 11
0
                protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
                {
                    hints.Add(new RenameFieldHint(typeof(SingleTableHierarchyBase), "FieldWithWrongName", "FieldWithRightName"));
                    hints.Add(new RenameFieldHint(typeof(SingleTableDescendant), "AnotherFieldWithWrongName", "AnotherFieldWithRightName"));

                    hints.Add(new RenameFieldHint(typeof(ConcreteTableHierarchyBase), "FieldWithWrongName", "FieldWithRightName"));
                    hints.Add(new RenameFieldHint(typeof(ConcreteTableDescendant), "AnotherFieldWithWrongName", "AnotherFieldWithRightName"));

                    hints.Add(new RenameFieldHint(typeof(ClassTableHierarchyBase), "FieldWithWrongName", "FieldWithRightName"));
                    hints.Add(new RenameFieldHint(typeof(ClassTableDescendant), "AnotherFieldWithWrongName", "AnotherFieldWithRightName"));
                }
Ejemplo n.º 12
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(typeof(V1.EntityWithDateTimeOffset).FullName, typeof(EntityWithDateTimeOffsetUpgrade)));
     hints.Add(new ChangeFieldTypeHint(typeof(EntityWithDateTimeOffsetUpgrade), "DateTimeOffset"));
     hints.Add(new ChangeFieldTypeHint(typeof(EntityWithDateTimeOffsetUpgrade), "DateTime"));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Adds the "auto" hints - e.g. hints for recycled types.
        /// </summary>
        /// <param name="hints">A set of hints to add new hints to
        /// (a shortcut to <see cref="Upgrade.UpgradeContext.Hints"/> collection).</param>
        protected virtual void AddAutoHints(Collections.ISet <UpgradeHint> hints)
        {
            var context         = UpgradeContext;
            var types           = Assembly.GetTypes();
            var registeredTypes = (
                from t in types
                where context.Configuration.Types.Contains(t)
                select t).ToArray();

            var recycledTypes =
                from t in registeredTypes
                let a = t.GetAttribute <RecycledAttribute>()
                        where a != null
                        select new { Type = t, Attribute = a };

            foreach (var r in recycledTypes)
            {
                var oldName = r.Attribute.OriginalName;
                if (oldName.IsNullOrEmpty())
                {
                    oldName = GetOriginalName(r.Type);
                }
                else if (!oldName.Contains("."))
                {
                    string ns = TryStripRecycledSuffix(r.Type.Namespace);
                    oldName = ns + "." + oldName;
                }
                if (string.IsNullOrEmpty(r.Attribute.OriginalName) && !context.ExtractedTypeMap.ContainsKey(oldName))
                {
                    continue;
                }
                var renameHint   = new RenameTypeHint(oldName, r.Type);
                var similarHints =
                    from h in hints
                    let similarHint = h as RenameTypeHint
                                      where similarHint != null
                                      where similarHint.NewType == renameHint.NewType
                                      select similarHint;
                if (!similarHints.Any())
                {
                    hints.Add(renameHint);
                }
            }

            var recycledProperties =
                from t in registeredTypes
                from p in t.GetProperties(BindingFlags.DeclaredOnly
                                          | BindingFlags.Instance
                                          | BindingFlags.Public
                                          | BindingFlags.NonPublic)
                let pa                   = p.GetAttribute <FieldAttribute>()
                                  let ra = p.GetAttribute <RecycledAttribute>()
                                           where pa != null && ra != null
                                           select new { Property = p, Attribute = ra };

            foreach (var r in recycledProperties)
            {
                var oldName = r.Attribute.OriginalName;
                if (!string.IsNullOrEmpty(oldName))
                {
                    hints.Add(new RenameFieldHint(r.Property.DeclaringType, oldName, r.Property.Name));
                }
            }
        }
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(typeof(V1.MyEntity).FullName, typeof(MyEntity)));
 }
Ejemplo n.º 15
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RemoveFieldHint(typeof(Model1.Owner).FullName, "T"));
     hints.Add(new RemoveTypeHint(typeof(Model1.Target).FullName));
 }
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(typeof(InconsistentDefaultDateTimeValuesModel1.MyEntity).FullName, typeof(InconsistentDefaultDateTimeValuesModel2.MyEntity)));
 }
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     _ = hints.Add(new RenameTypeHint(typeof(Version1.EntityWithFieldToRemove).FullName, typeof(EntityWithRemovedField)));
     _ = hints.Add(new RemoveTypeHint(typeof(Version1.EntityToRemove).FullName));
     _ = hints.Add(new RemoveFieldHint(typeof(Version1.EntityWithFieldToRemove).FullName, "Ref"));
 }
Ejemplo n.º 18
0
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RenameTypeModel.SingleTableDescendant1", typeof(SingleTableDescendant)));
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RenameTypeModel.ClassTableDescendant1", typeof(ClassTableDescendant)));
     hints.Add(new RenameTypeHint("Xtensive.Orm.Tests.Upgrade.UpgradeAndNamingRulesAdvanced.SourceModels.RenameTypeModel.ConcreteTableDescendant1", typeof(ConcreteTableDescendant)));
 }
 protected override void AddUpgradeHints(Collections.ISet <UpgradeHint> hints)
 {
     hints.Add(new RenameTypeHint(typeof(V1.MyEntity1).FullName, typeof(MyEntity2)));
     hints.Add(new RenameFieldHint(typeof(MyEntity2), "Value", "Value2"));
 }