Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why doesn't my assembly see it's own entities?

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
0
0
GB
Hi,

I am getting this error
'HLP_DB.HLP': type used in a using statement must be implicitly convertible to 'System.IDisposable'

I don't get it, I have created a class library with the name space HLP_DB, in that I created a Entity Framework model HLP.

I have added a reference from my application class library project to my DB ORM class library (using HLP_DB). HLP derives from DbContext, and in that class it is using the name space System.Data.Entity.

If I am referencing an assembly that itself uses all the correct name spacing and derives from the needed classes that includes the interface IDisposable, why am I getting this error.

I'm using a class from a referenced project, it has all it needs to know to create an object of that class, why is my application class expecting me to reference the System.Data.Entity namespace, I'm not trying to use that namespace the object I'm instantiating is and correctly references it?

I'm trying to abstract away my ORM to a helper assembly that multiple applications can use, but seem to be hitting a brick wall.

I'm confused and would appreciate some guidance.

Thanks,
1DMF.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
I found this :
And tried the NuGet Package suggestion and now it's working as expected?

I still don't understand, my application class library is not using the EF, it's using an assembly that is, which correctly references the EF.

I thought using assemblies and classes are meant to be black boxes, I should not have to know or care about their implementation, and I wouldn't expect to have to include references to their dependencies, they do that themselves don't they?

Clarification would be appreciated.

1DMF.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Now I can't seem to create any classes of the ORM because the helper ORM class library's app.config isn't being used and the app is looing for the EF connection string in the localised app directory, why?

I don't want to hard code a connection string in app.config in each application I want this stored in the folder where all the model classes are stored for the helper ORM class assembly library?

I want it DRY and in one place used by the helper class library, not in each application directory folder.

This is getting annoying!

I must be missing something and would appreciate some assistance.

1DMF



"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top