Code review.

pull/81/head
Halil İbrahim Kalkan 9 years ago
parent b748c23028
commit 1311cfc8d5

@ -16,10 +16,12 @@ namespace AbpDesk.ConsoleDemo
{
var configuration = BuildConfiguration();
//Configure DbConnectionOptions by configuration file (appsettings.json)
services.Configure<DbConnectionOptions>(configuration);
services.Configure<AbpDbContextOptions>(options =>
{
//Configures all dbcontextes to use Sql Server with calculated connection string
options.Configure(context =>
{
context.DbContextOptions.UseSqlServer(context.ConnectionString);

@ -16,6 +16,8 @@ namespace AbpDesk.EntityFrameworkCore
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
//TODO: Use different classes to map each entity type?
modelBuilder.Entity<Ticket>(builder =>
{
builder.ToTable("DskTickets");

@ -9,9 +9,10 @@ namespace AbpDesk.EntityFrameworkCore
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpDeskEntityFrameworkCoreModule>();
services.AddAbpDbContext<AbpDeskDbContext>();
services.AddDefaultEfCoreRepositories<AbpDeskDbContext>(); //TODO: Move this into AddAbpDbContext as option
services.AddDefaultEfCoreRepositories<AbpDeskDbContext>(); //TODO: Move this into AddAbpDbContext as an option
services.AddAssemblyOf<AbpDeskEntityFrameworkCoreModule>();
}
}
}

@ -1,8 +1,6 @@
using System.IO;
using AbpDesk.EntityFrameworkCore;
using AbpDesk.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -25,23 +23,22 @@ namespace AbpDesk
{
var hostingEnvironment = services.GetSingletonInstance<IHostingEnvironment>();
//TODO: This code is pretty similar to AbpDeskConsoleDemoModule, so use a common code!
var configuration = BuildConfiguration(hostingEnvironment);
//Configure DbConnectionOptions by configuration file (appsettings.json)
services.Configure<DbConnectionOptions>(configuration);
services.Configure<AbpDbContextOptions>(options =>
{
//Configures all dbcontextes to use Sql Server with calculated connection string
options.Configure(context =>
{
context.DbContextOptions.UseSqlServer(context.ConnectionString);
});
});
services.AddDbContext<AbpDeskDbContext>(options =>
{
options.UseSqlServer("Server=localhost;Database=AbpDesk;Trusted_Connection=True;");
});
services.AddMvc();
}

Loading…
Cancel
Save