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 EntityFrameworkContext<TContext> : DbContext, IEntityFrameworkContext where TContext : DbContext | |
{ | |
public ObjectContext ObjectContext { get { return ((IObjectContextAdapter)this).ObjectContext; } } | |
protected EntityFrameworkContext() : base() | |
{ | |
Database.SetInitializer<TContext>(null); | |
} | |
protected EntityFrameworkContext(string nameOrConnectionString) : base(nameOrConnectionString) |
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
# add prompt | |
function Global:prompt {"PS [$Env:username]@$PWD`n>"} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} |
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
# Copyright 2017, Alexander Hass | |
# http://www.hass.de/content/setup-your-iis-ssl-perfect-forward-secrecy-and-tls-12 | |
# | |
# Version 1.8 | |
# - Windows 2016 powershell 5.1.14393.1532 requires 'else' statements in the same line after to the closing 'if' curly quote. | |
# Version 1.7 | |
# - Windows Version compare failed. Get-CimInstance requires Windows 2012 or later. | |
# Version 1.6 | |
# - OS version detection for cipher suites order. | |
# Version 1.5 |
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 ApplicationDbContext<TContext> : EntityFrameworkContext<TContext> where TContext : DbContext, IEntityFrameworkContext | |
{ | |
protected ApplicationDbContext() : this(new ConnectionStringProvider().GetDefaultConnectionString()) | |
{ | |
} | |
protected ApplicationDbContext(string nameOrConnectionString) : base(nameOrConnectionString) | |
{ | |
} | |
} |
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 NLogDbCommandInterceptor : IDbCommandInterceptor | |
{ | |
private ILogger _logger; | |
private readonly Func<NLogDbCommandInterceptor, ILogger> _loggerFactory = interceptor => LoggerFactory.Instance.Create(interceptor); | |
private ILogger Logger | |
{ | |
get | |
{ | |
if (_logger == null) |
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 interface IEntityFrameworkUnitOfWork : IUnitOfWork | |
{ | |
IEntityFrameworkContext Context { get; } | |
} | |
public interface IEntityFrameworkUnitOfWork<TContext> : IEntityFrameworkUnitOfWork where TContext : class, IEntityFrameworkContext | |
{ | |
new TContext Context { get; } | |
} |
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 interface IEntityFrameworkContext : IDataContext | |
{ | |
IDbSet<TEntity> GetDbSetOf<TEntity>() where TEntity : class; | |
void MarkAsAdded(object entity); | |
void MarkAsModified(object entity); | |
void MarkAsDeleted(object entity); | |
void MarkAsUnchanged(object entity); | |
void ExtendQueryTimeout(); | |
} |
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 EntityFrameworkUnitOfWork : IEntityFrameworkUnitOfWork | |
{ | |
private readonly IEntityFrameworkContext _context; | |
public EntityFrameworkUnitOfWork(IEntityFrameworkContext context) | |
{ | |
_context = context; | |
} | |
public IEntityFrameworkContext Context |
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 abstract class EntityFrameworkRepository<TEntity> : Disposable, IRepository<TEntity> where TEntity : IEntity | |
{ | |
protected readonly IEntityFrameworkUnitOfWork _uow; | |
protected readonly IEntityFrameworkContext _context; | |
protected EntityFrameworkRepository(IEntityFrameworkUnitOfWork uow) | |
{ | |
_uow = uow; | |
_context = uow.Context; | |
} |
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 DynamicEntityTypeConfiguration<TConfiguration> : EntityTypeConfiguration<TConfiguration> where TConfiguration : class, new() | |
{ | |
} |
NewerOlder