public void MongodbCreate_Test_Code() { var types = BaseTemplate.GetMongoEntityTypes(); var typeService = Resolve <ITypeService>(); foreach (var type in types) { ServcieTemplate.Create(type); RepositroyTemplate.Create(type); ApiControllerTemplate.CreateApiController(type, "ObjectId"); } }
public void SqlServer_Code() { Resolve <ITableService>().Init(); var tables = Resolve <ITableService>().GetList(r => r.TableType == TableType.SqlServer); var typeService = Resolve <ITypeService>(); foreach (var item in tables) { var type = item.Type.GetTypeByFullName(); Assert.NotNull(type); ServcieTemplate.Create(type); RepositroyTemplate.Create(type); ApiControllerTemplate.CreateApiController(type, "long"); } }
public void TestCreateCode_testSingle() { var type = typeof(PostRole); // var type = typeof(IAutoReportService); ServcieTemplate.Create(type); RepositroyTemplate.Create(type); ApiControllerTemplate.CreateApiController(type, "ObjectId"); var typeService = Resolve <ITypeService>(); // AdminControllerTemplate.Create(type, "ObjectId", typeService); // type = typeof(CustomShopRecord); //ServcieTemplate.Create(type); //RepositroyTemplate.Create(type); //ApiControllerTemplate.CreateApiController(type, "ObjectId"); }
public void MongodbCreate_Code() { Resolve <ITableService>().Init(); var tables = Resolve <ITableService>().GetList(r => r.TableType == TableType.Mongodb); tables = tables.Where(r => !r.Type.Contains("Base")).ToList(); var typeService = Resolve <ITypeService>(); foreach (var item in tables) { var type = item.Type.GetTypeByFullName(); Assert.NotNull(type); ServcieTemplate.Create(type); RepositroyTemplate.Create(type); ApiControllerTemplate.CreateApiController(type, "ObjectId"); } }
public void CreateCode(Type type, string entityPath) { var keyIdType = Reflection.GetMemberType(type, "Id"); if (keyIdType == null) { Console.WriteLine($@"{type.Name}非实体,请重新输入"); return; } var idType = "long"; if (keyIdType.Name.Contains("ObjectId")) { idType = "ObjectId"; } ServcieTemplate.Create(type, idType, entityPath); //Console.WriteLine(@"服务代码已生成"); RepositroyTemplate.Create(type, idType, entityPath); //Console.WriteLine(@"仓储代码已生成"); ApiControllerTemplate.CreateApiController(type, idType, entityPath); //Console.WriteLine(@"Api接口代码已生成"); }