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); }
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); } }
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); }
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()); }