caching - EfCachingProvider and DbContext -


I'm trying to find out how to use Ifsikingprowaider from Antiti Framework and Dibisionteks I i to generate model classes Use EF 4.x DBCTNET Generator for C #. I have already added the reference to EFProviderWrapperToolkit, EFCachingProvider, EftracingProvider. The configuration file has also been modified:

  & lt; ConnectionStrings & gt; & Lt; "= Pass Password: server = MYSERVER; database = mydb; User ID = user Trusted_Connection = false; encrypt = true; Connection Timeout = 30;" Adding names = "MyEntities" connectionstring = Provider name = "Efroring provider" /> & Lt; / ConnectionStrings & gt; & Lt; System.data & gt; & Lt; DbProviderFactories & gt; & Lt; Add name = "EF caching data provider" invariant = "EFCachingProvider" Description = "caching provider wrapper" type = "EFCachingProvider.EFCachingProviderFactory, EFCachingProvider, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = def642f226e0e59b" / & gt; & Lt; ", EFTracingProvider.EFTracingProviderFactory, EFTracingProvider Version = 1.0.0.0, Culture = neutral, PublicKeyToken = def642f226e0e59b" add name = "EF tracing data provider type" invariant = "EFTracingProvider" Description = "Provider wrapper tracing" = / & gt; & Lt; Add name = "EF Generic Provider Wrapper" irrevocable = "EFPRIderRepreer" Details = "Generic Provider Rapper" type = "EFPRIIDRoperatorKit.fprownerdrafferfatter, EFPRIderPropricToolkitKit, version = 1.0.0.0, culture = neutral, public keycon = df 642f226a A5 9 B "/> & Lt; / DbProviderFactories & gt; & Lt; /system.data>   

But when the application starts, it throws in line with an error EFProviderWrapperToolkit in DbConnectionWrapper:

  DbProviderFactory factory = DbProviderFactories.GetFactory (providerInvariantName);   

This class is inherited from DbContext:

  public class MyEntities: DbContext {public MyEntities (): base ( "MyEntities") {} protected override IncludeMetadataConvention & gt; () OnModelCreating (DbModelBuilder modelBuilder) {modelBuilder.Conventions.Remove & lt; ModelBuilder.Entity & LT; Products & gt; () ToTable ("Product"). ModelBuilder.Entity & LT; ProductPhoto & gt; () ToTable ("ProductPhoto") .; Base.OnModelCreating (modelBuilder); } Public DbSet & lt; Products & gt; Product {Received; Set; } Public DbSet & lt; ProductPhoto & gt; Product photo {receive; Set; }}   

I have already read the post, but it has not resolved my problem.

Does anyone know how to do this?

We've used the EFCing Provider unit framework and code first you see our implementation for our source code You can.

We found that there are many examples which tracing providers show but nothing that the code coding provider has shown with the code first.

Not just working with our code outside of the box. We had a problem using DbContext and TransactionScope . To call, the EFCachingProvider was overridden in the cover, and by which the redirect was redistributed, we needed to use the transaction from the connection instead of TransactionScope . We can not take a connection with our DbContext because this connection handles itself, so we used the built in ObjectContext Private Readonly IDbTransaction _transaction;

etc

  _objectContext = ((IObjectContextAdapter) _context). Objectcontact; If (_objectContext.Connection.State! = ConnectionState.Open) {_objectContext.Connection.Open (); _transaction = _objectContext.Connection.BeginTransaction (); }   

The caching provider then stops the call properly. We do not allow _transaction objects to be Commit () or rollback etc.

You can see our full implementation of the unitoffer class.

Comments