This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using SimpleInjector; | |
namespace ConsoleApp2 | |
{ | |
internal class Program | |
{ | |
private readonly IQueryHandler<Query, PaginatedResult<Model>> handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Data.Entity; | |
namespace ConsoleApplication1 | |
{ | |
public class MyDbContext : DbContext | |
{ | |
public MyDbContext() | |
: base("name=MyDbContext") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyContext : DbContext | |
{ | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
/* Creates: | |
* Table Foo with two columns: Id (PK) and FK_BarId (FK) | |
* Table Bar with one column: Id (PK) | |
*/ | |
modelbuilder.Entity<Foo>() | |
.HasRequired(m => m.Bar) |