Fetch the repository succeeded.
This action will force synchronization from 旺仔/Zxw.Framework.NetCore, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
基于EF Core的Code First模式的DotNetCore快速开发框架
Nuget [最新版本:3.1.2]
开发环境
支持的数据库
日志组件
DI组件
AOP缓存组件使用
本项目采用的AOP中间件 :AspectCore.Extensions.Cache
2019/12/17
services.AddCoreX(config=> { })
2019/09/16
2019/09/15
2019/08/11
a.启用代码生成器
//启用代码生成器
services.UseCodeGenerator(new CodeGeneratorOption());
b.使用代码生成器
//CodeFirst---根据model生成其他各层的代码
dbContext.CodeFirst().GenerateAll(ifExsitedCovered:true);
//DbFirst---根据现有数据表生成各层代码
dbCOntext.DbFirst().GenerateAll(ifExsitedCovered:true);
2019/04/25
2019/04/18
//注入数据库上下文
services.AddDbContextFactory(factory =>
{
factory.AddDbContext<PostgreSQLDbContext>("db1", new DbContextOption(){ConnectionString = "User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=ZxwPgDemo;Pooling=true;" });
factory.AddDbContext<SqlServerDbContext>("db2", new DbContextOption() { ConnectionString = "" });
factory.AddDbContext<MongoDbContext>("db3", new DbContextOption() { ConnectionString = "" });
});
//获取
public class TestController
{
public IDbContextCore DbContext1 { get; set; }
public IDbContextCore DbContext2 { get; set; }
public IDbContextCore DbContext3 { get; set; }
public TestController(DbContextFactory factory)
{
DbContext1 = factory.GetDbContext("db1");
DbContext2 = factory.GetDbContext("db2");
DbContext3 = factory.GetDbContext("db3");
}
public void Run()
{
var db = DbContext1.GetDatabase();
Console.WriteLine();
}
}
public class TestRepository: BaseRepository<MongoModel, ObjectId>, IMongoRepository
{
[FromDbContextFactory("db1")]
public IDbContextCore DbContext1 { get; set; }
[FromDbContextFactory("db2")]
public IDbContextCore DbContext2 { get; set; }
[FromDbContextFactory("db3")]
public IDbContextCore DbContext3 { get; set; }
public void Run()
{
Console.WriteLine("Over!");
}
public TestRepository(IDbContextCore dbContext) : base(dbContext)
{
}
}
2018/09/24
2018/08/26
2018/07/06 合并dev分支到master
Sign in for post a comment
Comments ( 0 )