Closed adayIvey closed 7 years ago
Downgraded the project to use .NETStandard 1.3
. Now it should be compatible with .NET v4.5.1 via https://github.com/VahidN/EFSecondLevelCache.Core/commit/e8ad4f6a993dc8fe26b9bdae5d99a4eb3eced727
PM>Update-Package
Ok, just to be clear I should download the code and code compile it to 1.3 instead of using nuget
Sent from Ninehttp://www.9folders.com/
From: Vahid Nasiri notifications@github.com Sent: Feb 9, 2017 4:32 PM To: VahidN/EFSecondLevelCache.Core Cc: Day, Andrew; Author Subject: Re: [VahidN/EFSecondLevelCache.Core] EFSecondLevelCache.Core for .net 4.5.1 (#3)
Downgraded the project to use .NETStandard 1.3. Now it should be compatible with .net v4.5.1 via e8ad4f6https://github.com/VahidN/EFSecondLevelCache.Core/commit/e8ad4f6a993dc8fe26b9bdae5d99a4eb3eced727
PM>Update-Package
- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/VahidN/EFSecondLevelCache.Core/issues/3#issuecomment-278780536, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AO5DU982mP3tocjzAAqYJxUV05XCfmzhks5ra4XugaJpZM4L8lMD.
The updated NuGet package contains the compiled version against the .NETStandard 1.3
.
Thank you
Sent from Ninehttp://www.9folders.com/
From: Vahid Nasiri notifications@github.com Sent: Feb 9, 2017 4:59 PM To: VahidN/EFSecondLevelCache.Core Cc: Day, Andrew; Author Subject: Re: [VahidN/EFSecondLevelCache.Core] EFSecondLevelCache.Core for .net 4.5.1 (#3)
Closed #3https://github.com/VahidN/EFSecondLevelCache.Core/issues/3.
- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/VahidN/EFSecondLevelCache.Core/issues/3#event-956391810, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AO5DUx1_HT0MiUzZNMAtV_wESxDCKImLks5ra4xGgaJpZM4L8lMD.
Sorry one other question do u have a sample Context I am having trouble setting up the SaveChanges override specifically the part to InvalidateCacheDependencies
Any help would be appreciated thanks.
From: Vahid Nasiri [mailto:notifications@github.com] Sent: Thursday, February 09, 2017 5:00 PM To: VahidN/EFSecondLevelCache.Core EFSecondLevelCache.Core@noreply.github.com Cc: Day, Andrew aday@ivey.ca; Author author@noreply.github.com Subject: Re: [VahidN/EFSecondLevelCache.Core] EFSecondLevelCache.Core for .net 4.5.1 (#3)
The updated NuGet package contains the compiled version against the .NETStandard 1.3.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/VahidN/EFSecondLevelCache.Core/issues/3#issuecomment-278787658, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AO5DUx1_HT0MiUzZNMAtV_wESxDCKImLks5ra4xGgaJpZM4L8lMD.
Yes. Follow the EFSecondLevelCache.Core.AspNetCoreSample. Specially its SampleContext and Startup classes.
Thanks, for your help.
I must be missing something cause my app is not built on aspnetcore it is a 4.6.1 console app the is using a efcore (4.6.1) dll so I do not have a startup class etc…
To be honest I would like to be able to configure the EFCacheServiceProvider in my efcore contect class instead of injecting it. Does that make sense?
Here is my context that I have with my old code commented out (using the none core version of EFCacheServiceProvider).
public partial class IveyCoreContext
{
public IveyCoreContext(string connection = "", bool enableNoTracking = false) : base(GetDbContextOptions(connection))
{
//https://docs.microsoft.com/en-us/ef/core/querying/tracking
if (enableNoTracking == true)
{
this.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
}
}
public override int SaveChanges()
{
this.ChangeTracker.DetectChanges();
var changedEntityNames = this.GetChangedEntityNames();
var result = base.SaveChanges();
EFCacheServiceProvider test = new EFCacheServiceProvider()
return result;
}
//public override int SaveChanges()
//{
// return SaveAllChanges(invalidateCacheDependencies: true);
//}
//public int SaveAllChanges(bool invalidateCacheDependencies = true)
//{
// var changedEntityNames = getChangedEntityNames();
// var result = base.SaveChanges();
// if (invalidateCacheDependencies)
// {
// new EFCacheServiceProvider().InvalidateCacheDependencies(changedEntityNames);
// }
// return result;
//}
//private string[] getChangedEntityNames()
//{
// return this.ChangeTracker.Entries()
// .Where(x => x.State == EntityState.Added ||
// x.State == EntityState.Modified ||
// x.State == EntityState.Deleted)
// .Select(x => System.Data.Entity.Core.Objects.ObjectContext.GetObjectType(x.Entity.GetType()).FullName)
// .Distinct()
// .ToArray();
//}
private static DbContextOptions GetDbContextOptions(string connection)
{
var dbContextOptionsBuilder = new DbContextOptionsBuilder();
if (connection == string.Empty)
{
var serviceProvider = new ServiceCollection().AddEntityFrameworkInMemoryDatabase().BuildServiceProvider();
dbContextOptionsBuilder.UseInMemoryDatabase().UseInternalServiceProvider(serviceProvider);
}
else
{
dbContextOptionsBuilder.UseSqlServer(connection);
}
var dbContextOptions = dbContextOptionsBuilder.Options;
return dbContextOptions;
}
private static void Initialize()
{
//this
}
}
}
From: Vahid Nasiri [mailto:notifications@github.com] Sent: Friday, February 10, 2017 3:02 PM To: VahidN/EFSecondLevelCache.Core EFSecondLevelCache.Core@noreply.github.com Cc: Day, Andrew aday@ivey.ca; Author author@noreply.github.com Subject: Re: [VahidN/EFSecondLevelCache.Core] EFSecondLevelCache.Core for .net 4.5.1 (#3)
Yes. Follow the EFSecondLevelCache.Core.AspNetCoreSamplehttps://github.com/VahidN/EFSecondLevelCache.Core/tree/master/src/Tests/EFSecondLevelCache.Core.AspNetCoreSample. Specially its SampleContexthttps://github.com/VahidN/EFSecondLevelCache.Core/blob/master/src/Tests/EFSecondLevelCache.Core.AspNetCoreSample/DataLayer/SampleContext.cs#L121 and Startuphttps://github.com/VahidN/EFSecondLevelCache.Core/blob/master/src/Tests/EFSecondLevelCache.Core.AspNetCoreSample/Startup.cs#L27 classes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/VahidN/EFSecondLevelCache.Core/issues/3#issuecomment-279051460, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AO5DU93W29wYew9ZBHlc4gQWgRu3r13gks5rbMJBgaJpZM4L8lMD.
Follow .NET46Sample.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.
currently i am using efcore v1.1.0 with .net v4.5.1 is there any chance you will have a version of EFSecondLevelCache.Core that will work with 4.5+ I was able to use EFSecondLevelCache but that also pulls in ef 6.1.3 as a dependency that i do not need.