public class Relation{
public Type Type1{get;set;}
public RelationCount Count1{get;protected set;}
public Type Type2{get;set;}
public RelationCount Count2{get;set;}
}
public class RelationOneToOne:Relation{
public RelationOneToOne() :base()
{
Count1 = RelationCount.One;
}
}
public enum RelationCount{One, Multi}
public class RelationTableInfo{
public Relation Relation;
public string TableName;
public string Colname1;
public string Colname2;
public static RelationInfo GetDefaultInfo(RelationOneToOne relation)
{
RelationInfo info=new RelationInfo();
info.Relation = relation;
info.TableName = relation.Type1.Name;
info.Colname1 = relation.Type1.Name+"ID";
info.Colname2 = relation.Type2.Name+"ID";
}
public static RelationInfo GetDefaultInfo(RelationOneToOne relation)
{
RelationInfo info=new RelationInfo();
info.Relation = relation;
info.TableName = relation.Type1.Name;
info.Colname1 = relation.Type1.Name+"ID";
info.Colname2 = relation.Type2.Name+"ID";
}
public static RelationInfo GetDefaultInfo(RelationMToM relation)
{
RelationInfo info=new RelationInfo();
info.Relation = relation;
info.TableName = relation.Type1.Name + relation.Type2.Name;
if
info.Colname1 = relation.Type1.Name+"ID";
info.Colname2 = relation.Type2.Name+"ID";
}
}
}
public class ObjectInfo{
public string Name;
public List Properties;
public Indexies;
}
public class ColumnInfo{
public string Name;
public string Type;
public int Length;
public SQLTypeName{
get{
return Type;
}
public class Tables{
Map tables;
public ObjectInfo this(string name)
get{ tables.ContainKey(name),return tables[name];
ObjectInfo info = new ObjectInfo();
else tables.Add(name);
}
}
}
网友评论