Why do I have to add System.Data.Entity to use System.Data.Objects?

I am still learning about programming as you can probably tell by my question.

How come I have to add System.Data.Entity as a reference to my project to use System.Data.Objects? Does Objects live in namespace System.Data.Objects? Wouldnt it make sense for Objects to live in System.Data.Entity.Objects?

Answers


Namespaces and assemblies are entirely separate concepts. Sometimes - heck, often they will match up, but they certainly don't have to. You don't tend to use the mscorlib namespace, for example :) Likewise most of the System.Linq types are in System.Core.dll. One assembly can contain types in multiple namespaces, and multiple assemblies can contribute to the same namespace.

It's worth keeping the two concepts as distinct in your mind as possible. Fortunately it's easy to find out where a type "lives" in both respects from MSDN.


The .NET namespaces are cross-assembly. This allows the library designers to expand particular namespaces as appropriate without polluting core libraries with non-core functionality. The naming of individual DLLs is unfortunate, but it is not intended to reflect namespace information in the way you're thinking.

In your example, System.Data.Entity is a DLL containing elements from a number of different namespaces. One of these is System.Data.Objects, as you've discovered.


The System.Data.Objects namespace is defined in System.Data.Entity.dll.


The assembly is called System.Data.Entity which means the DLL System.Data.Entity.dll.

System.Data.Objects is a namespace within that assembly.

A single assembly may contain one or more namespaces possibly all with different names.


Need Your Help

Turn FBProfilePictureView into UIImage

ios objective-c facebook uiimageview

I have a Facebook login that gets the users profilePicture, lblUsername, and lblEmail. I know that the FBProfilePictureView is a UIView that contains a UIImageView.

How to reference and run a python document from the python interpreter

windows interpreter execute python-3.5

I just want to be able to run a python script from the interpreter, so that I can work on my changes to my script in notepad or other editor, save, and then interactively test changed code in the p...