INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

(OP)
Hi,

I am getting this error

Quote:

'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

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

(OP)
I found this : http://stackoverflow.com/questions/2703889/entityf...

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

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close