Simple ObjectContextManager Question

Simple ObjectContextManager Question

Old forum URL: forums.lhotka.net/forums/t/12559.aspx


ashishsinha24 posted on Friday, March 28, 2014

Hi,

 

I am new to CSLA. And got stuck up.

 

i am getting the following error when using the Entity frameework.

 

Error 1 The type 'ShasPatho.DalEf.ShasPathoEntities' cannot be used as type parameter 'C' in the generic type or method 'Csla.Data.ObjectContextManager<C>'. There is no implicit reference conversion from 'ShasPatho.DalEf.ShasPathoEntities' to 'System.Data.Objects.ObjectContext'.

 

any help would be great.

 

regards

 

ashish

msrs_it replied on Saturday, April 05, 2014

I'm also having the same issue. Did you found solution for this?

 

Please let me know if you have any solution

 

Thanks & Regards

SreeRam

JonnyBee replied on Saturday, April 05, 2014

Hi,

Seems like your EFContext is of type DbContext and not ObjectContext. For more information see:
http://www.entityframeworktutorial.net/EntityFramework4.3/dbcontext-vs-objectcontext.aspx  

The DbContext is not part of .NET Framework and exists in the EF X assemblies. So you need to add a NuGet reference to the Csla .NET ADO.NET EF X package and use the DbContextManager class instead. 

This is done so that CSLA is not limited to a specific version of EF. 

ashishsinha24 replied on Sunday, April 06, 2014

Hi,

Still the sample problem. Added CSLA.Net ADO.NET EF 6.0 package.  see attached file.

 

regards

ashish

kreid replied on Tuesday, January 13, 2015

@ashish Same here. I have referenced Csla.Data.EF6, but I still get the error, because ObjectContextManager is in the Csla.Data namespace.

Csla.Data.EF6 only seems to contain the DbContextManager. Did you ever figure out this one? Does CSLA force us to use DbContext with EF6?

msrs_it replied on Wednesday, January 14, 2015

See the latest reply of JonnyBee in this post

msrs_it replied on Saturday, April 12, 2014

Thank you jonny, issue was resolved.

Copyright (c) Marimer LLC