public static RelationBase CloneRelation(this RelationBase relation, Type type)
        {
            var clone = Activator.CreateInstance(type);

            foreach (var pi in type.GetProperties().Where(pi => pi.Name != "Id"))
            {
                pi.SetValue(clone, pi.GetValue(relation));
            }

            return((RelationBase)clone);
        }
Example #2
0
 public string GenerateWithRecursion(RelationBase top)
 {
     if (top is RootRelation)
     {
         return((top as RootRelation).Key);
     }
     else
     {
         InnerRelation iRel = top as InnerRelation;
         return(GenerateWithRecursion(iRel.NormParent) + ((RootRelation)iRel.AssocParent).Key);
     }
 }
Example #3
0
        public RelationBase Assimilate(string text)
        {
            RelationBase relTop = null;

            foreach (char c in text)
            {
                RootRelation relC = this.pile.Create(c.ToString());
                if (relTop != null)
                {
                    relTop = this.pile.Create(relTop, relC);
                }
                else
                {
                    relTop = relC;
                }
            }

            return(relTop);
        }
Example #4
0
        public string Generate(RelationBase top)
        {
            StringBuilder text = new StringBuilder();

            do
            {
                if (top is RootRelation)
                {
                    text.Insert(0, (top as RootRelation).Key);
                }
                else
                {
                    InnerRelation inner = top as InnerRelation;
                    text.Insert(0, ((RootRelation)inner.AssocParent).Key);
                    top = inner.NormParent;
                }
            } while (top is InnerRelation);
            text.Insert(0, ((RootRelation)top).Key);

            return(text.ToString());
        }
 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Configurations.Add(EntityBase.BaseConfig());
     modelBuilder.Configurations.Add(RelationBase.BaseConfig());
 }