/// <summary> /// 移除仓储中的根对象 /// </summary> /// <param name="define"></param> /// <param name="obj"></param> public void Delete(AggregateRootDefine define, DynamicRoot obj) { var metadataType = define.MetadataType; var model = DataModel.Create(metadataType); model.Delete(obj); }
public DynamicRoot Find(AggregateRootDefine define, object id, QueryLevel level) { var metadataType = define.MetadataType; var model = DataModel.Create(metadataType); return(model.QuerySingle <DynamicRoot>(id, level)); }
public void TypeDefine1() { //const string code = "{id:'int',name:'ascii,10',person:{name:'string,10',sex:'byte'},first:'person',menu:{person:{id:'long',name:'string,5'},name:'string,10',parent:'menu',childs:['menu']},others:[{id:'int',name:'string',person:'menu.person'}],values:['string,10'],others2:'others'}"; const string code = "{id:'int',name:'ascii,10'}"; var define = new AggregateRootDefine("Ad", code); var ps = define.Properties.ToArray(); AssertPropertyValue(ps[0], "Id", typeof(int)); AssertPropertyValue(ps[1], "Name", typeof(string)); }
public void TypeDefine2() { const string code = "{id:'int',name:'ascii,10',person:{name:'string,10',sex:'byte',hourse:{address:'string,10'},son:'person'},values:['string,10'],menu:{person:{id:'long',name:'string,5'},name:'string,10',parent:'menu',childs:['menu']}}"; var define = new AggregateRootDefine("Admin", code); var ps = define.Properties.ToArray(); AssertPropertyValue(ps[0], "Id", typeof(int)); AssertPropertyValue(ps[1], "Name", typeof(string)); AssertPerson(ps[2]); AssertPropertyList(ps[3], "values", typeof(List <string>)); AssertMenu(ps[4]); }
public void TypeDefine3() { const string code = "people:{id:'int',name:'ascii,10',son:'people',wife:{sex:'byte',father:{name:'string'},son:'people'}}"; var define = new AggregateRootDefine("People", code); //var ps = define.Properties.ToArray(); //AssertPropertyValue(ps[0], "Id", typeof(int)); //AssertPropertyValue(ps[1], "Name", typeof(string)); //AssertPropertyObject(ps[2], "Son", "People"); //AssertPropertyObject(ps[3], "Wife", "PeopleWife"); //var wifeProperties = DomainProperty.GetProperties(ps[3].PropertyType).ToArray(); //AssertPropertyObject(wifeProperties[1], "Father", "PeopleWifeFather"); //AssertPropertyObject(wifeProperties[2], "Son", "People"); }