May 9, 2012 at 9:11 AM

Am I understanding this correctly, Effort uses objectcontext?

How does this affect project that are using dbcontext instead? Are there plans of supporting both?

May 11, 2012 at 9:08 AM


If you download the whole source code, you will find an Effort.CodeFirst project too that gives you DbContext support. Unfortunatelly the author of this project does not have much free time, so it lacks tutorials or demo projects. But since this feature might become more important (especially with the release of .NET4.5), I am going to dig in and create some documentation in the near future.

Thanks for the feedback,

Jun 6, 2012 at 11:18 PM
Edited Jun 6, 2012 at 11:18 PM

Today I have uploaded a beta release that has Code First support. Here you can a find a tutorial about it:


I would appreciate if you could try it and let me if it works properly.

Sep 27, 2012 at 3:29 PM
Edited Sep 27, 2012 at 3:32 PM


Does it support database/model first, too?


Sep 27, 2012 at 3:44 PM

Of course, just consider using Effort.EntityConnectionFactory or Effort.ObjectContextFactory. However, contrary to the Code First approach, they require the presence of a connection string that references the appropriate EDMX metadata files.

Sep 28, 2012 at 10:58 AM
Edited Sep 28, 2012 at 3:47 PM

Hi Tamas,

Thanks for the quick response.

As you advised, I am using EntityConnectionFactory (new MyContext(EntityConnectionFactory.CreateTransient("name=MyConnection"))) to initialize my context instance (my context derives from DbContext), but it throws a MetadataException with the following message:

Schema specified is not valid. Errors:
(0,0) : error 0040: The Type nvarchar is not qualified with a namespace or alias. Only primitive types can be used without qualification.

I figured it out that the root cause is in the EffortProviderManifest, because the EffortProviderManifest.xml file does not contain the definitions of types used in my existing storage model (eg. nvarchar) which in my case are MS SQL Server specific data types.

So I decided to extend the EffortProviderManifest with the data types supported by the SqlClient ProviderManifest, but unfortunately this caused an ArgumentException inside the NMemory module with the following message: "The type of 'SHORTCUT' property is 'System.Byte[]', use 'NMemory.Data.Binary' instead. Parameter name: TEntity"

What am I doing wrong?


Sep 28, 2012 at 11:11 AM
Edited Sep 28, 2012 at 11:13 AM

Might I ask you to open a new Issue for this? Give a title something like this: "Full MS SQL type support". I will provide more info there.

Sep 28, 2012 at 3:49 PM

Issue created: http://effort.codeplex.com/workitem/671