Problems with walkthrough

Nov 30, 2011 at 7:21 PM

I'm trying to follow the walkthrough, but so far, I'm having some difficulties.
Keep in mind that I'm unfamiliar with Entity Framework, so some of my problems might be caused by simple ignorance.

I'm unable to recompile the walkthrough solution after step 5 (labeled 1. in the walkthrough, but located between 4 and 6).
If I follow the walkthrough steps to the letter (except for fixing a typo, Northwind instead of Norhwind), I get these errors:

SdxWalkthrough\NorthwindEFEntities.cs(7,9): error CS0111: Type 'SdxWalkthrough.NorthwindEFEntities' already defines a member called 'NorthwindEFEntities' with the same parameter types
SdxWalkthrough\NorthwindEFModel.cs(43,16): (Related location)

Of course, the constructor is redefined, so I comment it out and recompile. But then I get:

SdxWalkthrough\NorthwindEFEntities.cs(14,13): error CS0311: The type 'SdxWalkthrough.NorthwindEFEntities' cannot be used as type parameter 'TContext' in the generic type or method 'System.Data.Entity.Database.SetInitializer<TContext>(System.Data.Entity.IDatabaseInitializer<TContext>)'. There is no implicit reference conversion from 'SdxWalkthrough.NorthwindEFEntities' to 'System.Data.Entity.DbContext'.
SdxWalkthrough\NorthwindEFModel.cs(27,26): (Related location)
SdxWalkthrough\NorthwindEFEntities.cs(5,26): (Related location)

As this point, I realize that NorthwindEFEntities class must derive from DbContext (and not ObjectContext), but making this transition is not obvious to me.

Any help would be appreciated.



Dec 1, 2011 at 6:21 AM

Patr, thank you for your feedback.

We will fix the typo and the enumeration in the online documentation shortly.

As for compiler errors it looks like you either lost the keyword "partial" somehow when you copy-pasted code sample from 4.b. (it will be fixed to 5.b.) "Add a creation method for SSAS OLAP connection into context" / "Copy and paste the following code:", or you pasted that code into an existing file NorthwindEFModel.Context.cs located under file in a solution explorer, instead of adding a brand new class as suggested in sub-step a.

To fix your problem make sure you have original content in NorthwindEFModel.Context.cs and copy-paste code from sub-step b. with no changes including "partial" keyword.

SdxWalkthrough.NorthwindEFEntities class does inherit from DbContext indeed. It happens in the same  NorthwindEFEntities class, but in another partial class file "NorthwindEFModel.Context.cs" that I have just mentioned above. (See line 16 "public partial class NorthwindEFEntities : DbContext").

In case if you are not familiar with partial classes .NET feature yet, we recommend to look into it in MSDN as it might be useful for you to know in cases when you deal with code autogenerated by tools (in our example NorthwindEFModel.Context.cs is generated by T4 template generator).

We will appreciate if you follow up with either further questions or a success confirmation.



Agile Design LLC

Dec 1, 2011 at 12:52 PM

Hi Sergey and thanks for the prompt response.

We will fix the typo and the enumeration in the online documentation shortly.

[PATR] Thanks.

After reading your email and checking everything that you mention, I realized I didn't have a file called "NorthwindEFModel.Context.cs". I then figured out that I had must have made a mistake in step 3, maybe picking the wrong generator? I deleted the *.tt and redid step 3, and it now compiles successfully. Thanks for your help.


Dec 1, 2011 at 1:00 PM
Edited Dec 1, 2011 at 1:30 PM

Other (small) issues:

- In step 6.a, the assembly attribute to add to assemblyinfo.cs is "AgileDesign.SsasEntityFrameworkProvider.Attributes.ModelAssembly" and not "AgileDesign.Utilities.ModelAssembly" as documented.

- The version of SsasEntityFrameworkProvider to put in the app.config is now (instead of


I was able to run the sample and get the expected answer. Thanks again for your help.


Dec 2, 2011 at 11:36 AM
Edited Dec 2, 2011 at 11:42 AM

Dear Pat,

We appreciate your helpful feedback.

All your points should be fixed in the updated walkthrough by now.

I am very glad you made it through successfully, even though you have never dealt with Microsoft Entity Framework before.



Agile Design LLC,