标签:
MyOql生成器需要一个配置文件,形如:
<MyOqlCodeGen> <Table db="dbo" Owner="dbo"> <Group Name="PlatForm"> <Entity Name="P_CarBrand" Enums="" PKs="ID" AutoIncreKey="ID" FKs="(Logo)()=S_SysAnnex:(ID)" /> <Entity Name="P_CarFactory" Enums="" PKs="ID" AutoIncreKey="ID" FKs="(BrandID)()=P_CarBrand:(ID)" /> <Entity Name="P_CarType" Enums="Level=CarLevelEnum" PKs="ID" AutoIncreKey="ID" FKs="(BrandID)()=P_CarBrand:(ID);(FactoryID)()=P_CarFactory:(ID)" /> <Entity Name="P_CarInfo" Enums="Status=CarMarketStatusEnum;Source=CarSourceEnum" PKs="ID" AutoIncreKey="ID" FKs="(TypeID)()=P_CarType:(ID)" /> </Group> </Table> <View db="dbo" Owner="dbo"> <Group Name="View"> <Entity Name="VTxtRes" Enums="Lang=LangEnum" PKs="Lang,ResID" MyTable="S_ResKey,S_ResValue" /> </Group> </View> <Proc Owner="dbo" db="dbo"> <Group Name=""> <Entity Name="P_Login" Return="result=PUserRule.Entity:out" MyTable="P_LoginUser" /> </Group> </Proc> <Function Owner="dbo" db="dbo"> <Group> <Entity Name="Split" TypeMap="Value=String" Paras="val=String:in,split=String:in" /> </Group> </Function> </MyOqlCodeGen>
对于复杂项目,手写这个Xml非常麻烦。我写了一个工具。
http://code.taobao.org/svn/MyMvcApp/MyTool/
该项目的配置文件被分解在 MyOqlCodeGen 文件夹中,重点:
MyOqlCodeGen_Auto_Table.init 是利用SQL的存储过程生成的: Dev_Ent
MyOqlCodeGen_My_Table.config 是需要我们配置的。配置的内容有:数据组,枚举项,BitSummarys,IdName,db,Owner 。
枚举项配置格式: 列名=枚举;...
配置完成后,运行批处理:生成实体代码.bat
标签:
原文地址:http://www.cnblogs.com/newsea/p/4530828.html