-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from darxis/dev
Release 1.1.1-beta3
- Loading branch information
Showing
25 changed files
with
418 additions
and
196 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: csharp | ||
solution: EntityFramework.LazyLoading.sln | ||
mono: none | ||
dotnet: 1.0.1 | ||
dist: trusty | ||
sudo: required | ||
services: | ||
- mysql | ||
- postgresql | ||
env: | ||
global: | ||
- DB_NAME=ContosoUniversity | ||
matrix: | ||
- DB=PostgreSql CONFIGURATION=Release | ||
#- DB=MySql CONFIGURATION=Release | ||
install: | ||
- dotnet restore | ||
before_script: | ||
- export Microsoft_EntityFrameworkCore_LazyLoading_Tests_DatabaseType=$DB | ||
#- sh -c "if [ '$DB' = 'MySql' ]; then mysql -e 'CREATE DATABASE \`$DB_NAME\`; USE \`$DB_NAME\`; CREATE TABLE \`__EFMigrationsHistory\` (\`MigrationId\` nvarchar(150) NOT NULL, \`ProductVersion\` nvarchar(32) NOT NULL, PRIMARY KEY (\`MigrationId\`));'; (cd tests/Microsoft.EntityFrameworkCore.LazyLoading.Tests && dotnet ef database update); fi" | ||
script: | ||
- dotnet build --configuration $CONFIGURATION | ||
- (cd tests/Microsoft.EntityFrameworkCore.LazyLoading.Tests && dotnet test --configuration $CONFIGURATION) |
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
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
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
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
31 changes: 31 additions & 0 deletions
31
...ft.EntityFrameworkCore.LazyLoading/Infrastructure/Internal/LazyLoadingOptionsExtension.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.LazyLoading.Internal; | ||
using Microsoft.EntityFrameworkCore.LazyLoading.Metadata.Internal; | ||
using Microsoft.EntityFrameworkCore.LazyLoading.Query.Internal; | ||
using Microsoft.EntityFrameworkCore.Metadata.Internal; | ||
using Microsoft.EntityFrameworkCore.Query.Internal; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.EntityFrameworkCore.LazyLoading.Infrastructure.Internal | ||
{ | ||
public class LazyLoadingOptionsExtension : IDbContextOptionsExtension | ||
{ | ||
public LazyLoadingOptionsExtension() | ||
{ | ||
} | ||
|
||
// NB: When adding new options, make sure to update the copy ctor below. | ||
|
||
// ReSharper disable once UnusedParameter.Local | ||
public LazyLoadingOptionsExtension(LazyLoadingOptionsExtension copyFrom) | ||
{ | ||
} | ||
|
||
public void ApplyServices(IServiceCollection services) | ||
{ | ||
services.AddScoped<IEntityMaterializerSource, LazyLoadingEntityMaterializerSource>(); | ||
services.AddScoped<EntityFrameworkCore.Internal.IConcurrencyDetector, ConcurrencyDetector>(); | ||
services.AddScoped<ICompiledQueryCache, PerDbContextCompiledQueryCache>(); | ||
} | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
...Microsoft.EntityFrameworkCore.LazyLoading/LazyLoadingDbContextOptionsBuilderExtensions.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.LazyLoading.Infrastructure.Internal; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
public static class LazyLoadingDbContextOptionsBuilderExtensions | ||
{ | ||
public static DbContextOptionsBuilder UseLazyLoading(this DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
var extension = GetOrCreateExtension(optionsBuilder); | ||
((IDbContextOptionsBuilderInfrastructure) optionsBuilder).AddOrUpdateExtension(extension); | ||
|
||
return optionsBuilder; | ||
} | ||
|
||
public static DbContextOptionsBuilder<TContext> UseLazyLoading<TContext>( | ||
this DbContextOptionsBuilder<TContext> optionsBuilder) | ||
where TContext : DbContext | ||
=> (DbContextOptionsBuilder<TContext>) UseLazyLoading((DbContextOptionsBuilder) optionsBuilder); | ||
|
||
private static LazyLoadingOptionsExtension GetOrCreateExtension(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
var existing = optionsBuilder.Options.FindExtension<LazyLoadingOptionsExtension>(); | ||
return existing != null | ||
? new LazyLoadingOptionsExtension(existing) | ||
: new LazyLoadingOptionsExtension(); | ||
} | ||
} | ||
} |
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
4 changes: 1 addition & 3 deletions
4
...EntityFrameworkCore.LazyLoading/Metadata/Internal/ILazyLoadingEntityMaterializerSource.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
namespace Microsoft.EntityFrameworkCore.LazyLoading.Metadata.Internal | ||
{ | ||
public interface ILazyLoadingEntityMaterializerSource<in TDbContext> | ||
where TDbContext : DbContext | ||
public interface ILazyLoadingEntityMaterializerSource | ||
{ | ||
void SetDbContext(TDbContext ctx); | ||
} | ||
} |
Oops, something went wrong.