0

Where in .edmx-file I can find the assembly name? Second, when I create my own partial class, how do I make it to appear in the same assembly?

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
Nuts
  • 2,755
  • 6
  • 33
  • 78

2 Answers2

1

There is no assembly name in the edmx file. The code generated from the edmx file becomes part of the project the edmx file is part of and therefore become part of assembly that is compiled for this project. Partial classes are mostly a compiler trick and when you compile partial classes the compiler will combine all the partial classes into one and in the assembly you will always have just one class.

Pawel
  • 31,342
  • 4
  • 73
  • 104
  • Ok, thank you. So as long as the .edmx is under the same Visual Studio project, it is also under the same assembly. My partial class cannot access the autogenerated properties (Intellisense not displaying them) so then it must be a problem with the namespace. I have defined the namespace for my partial class by taking it from the .edmx CSDL content – Nuts Mar 12 '13 at 07:49
  • Open the cs file generated for your model and copy use the namespace from there. I also have seen cases when Intellisense did not display anything even though references were correct. To be sure that you are really missing references you need to compile your project and see whether you have any errors. – Pawel Mar 12 '13 at 15:48
1

Keep in mind that in order for partial classes to work, all the partial classes must reside in the same Assembly and the same Namespace. In your case, suppose you have a class in your Entity Data model called Foo. Now, this Foo class will be a partial class residing in your .edmx file. Also, suppose that you want to extend this partial class with an additional property called Bar. What you will need to do is create another partial class named Foo in the same assembly, or basically the same project as the one containing your .edmx file, and add the new property Bar to that partial class implementation of Foo. Also, the new partial Foo class containing the Bar property will need to reside in the same Namespace as the Foo partial class residing in the .edmx file.

I hope this helps.

Ron Kanagy
  • 21
  • 2