Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/BSN.Commons.AutoMapper/BSN.Commons.AutoMapper.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
Expand Down Expand Up @@ -49,8 +49,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.3" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static IServiceCollection AddCommonsAutoMapper(this IServiceCollection se
IMapper mapper = mappingConfig.CreateMapper();

services.AddSingleton(mapper);

return services;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DatabaseFactory.cs" />
<Compile Include="Extensions\IQueryableExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RepositoryBase.cs" />
Expand Down
29 changes: 29 additions & 0 deletions Source/BSN.Commons.Orm.EntityFramework/DatabaseFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using BSN.Commons.Infrastructure;
using System.Data.Entity;

namespace BSN.Commons.Orm.EntityFramework
{
public class DatabaseFactory<TContext> : Disposable, IDatabaseFactory where TContext : DbContext, IDbContext, IAsyncDbContext
{
public DatabaseFactory(TContext context)
{
_dataContext = context;
}

public IDbContext Get()
{
return _dataContext;
}

public void Dispose()
{
_dataContext?.Dispose();
}

public IAsyncDbContext GetAsyncContext()
{
return _dataContext;
}
protected TContext _dataContext;
}
}
Loading
Loading