You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

ASP.NET Boilerplate(ABP)是否支持.NET Core 2.0下的NHibernate?

ABP对.NET Core 2.0下NHibernate的支持情况

Hey there! Great question—let me break this down for you clearly:

  • Yes, ASP.NET Boilerplate (ABP) does support NHibernate in .NET Core 2.0 environments
    ABP provides dedicated support for NHibernate via the Abp.NHibernate NuGet package, which has a version specifically adapted for .NET Core 2.0. You can safely reference this package in your project to integrate NHibernate seamlessly.

  • Configuration steps are straightforward
    To set up NHibernate in your ABP module, you'll configure it in the PreInitialize method of your module class. Here's a quick example of what that might look like:

    public override void PreInitialize()
    {
        Configuration.Modules.AbpNHibernate().FluentConfiguration
            .Database(MsSqlConfiguration.MsSql2012.ConnectionString(c => c.FromConnectionStringWithKey("Default")))
            .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(YourProjectModule).Assembly));
    }
    

    This lets you define your database provider, connection string, and mapping sources (like Fluent NHibernate mappings) directly within ABP's module system.

  • ABP's repository system works seamlessly with NHibernate
    You don't have to build your own repository layer from scratch. ABP offers a pre-built NHibernate repository implementation—just inherit NhRepositoryBase<TEntity, TPrimaryKey> for custom repositories, or use the generic IRepository<TEntity, TPrimaryKey> interface directly. This integrates perfectly with ABP's unit of work and dependency injection systems.

  • A quick note on versions
    While .NET Core 2.0 is supported, make sure you pick an ABP version that explicitly targets .NET Core 2.0. Newer ABP versions might have moved on to support newer .NET Core releases, but you can find compatible versions on NuGet by filtering for .NET Core 2.0 compatibility.

内容的提问来源于stack exchange,提问作者Lau YW

火山引擎 最新活动