Zxw.Framework.NetCore
Быстрая разработка на DotNetCore на основе EF Core в режиме Code First.
Nuget [последняя версия: 3.1.3.5]
Среда разработки:
Поддерживаемые базы данных:
Компоненты логирования:
Инъекционные компоненты:
Использование компонентов AOP для кэширования
В проекте используется промежуточное ПО AOP: AspectCore.Extensions.Cache
2019/12/17
services.AddCoreX(config=> { })
2019/09/16
2019/09/15
2019/08/11
// Включить генератор кода
services.UseCodeGenerator(new CodeGeneratorOption());
// CodeFirst — создать код для других слоёв на основе модели
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
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )