Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require a public parameterless ctor #72

Closed
guillaume-fr opened this issue Jun 25, 2014 · 1 comment
Closed

Do not require a public parameterless ctor #72

guillaume-fr opened this issue Jun 25, 2014 · 1 comment

Comments

@guillaume-fr
Copy link

Hi,

UpdateGraph requires entity type to have a visible parameterless ctor. This is not needed by EF, a protected parameterless ctor does the job.
I think you could remove the new() constraint and use Activator.CreateInstance<T>()

ghost pushed a commit that referenced this issue Aug 4, 2014
@ghost ghost closed this as completed Aug 4, 2014
@guillaume-fr
Copy link
Author

Activator.CreateInstance() doesn't work with a type that don't expose a public default ctor. My bad !
"Unhandled Exception: System.MissingMethodException: Default constructor not found for type ..."

Please, reopen this issue.

We could use the context to create entity Context.Set<T>().Create() It may create a proxy type I don't know if this is an issue... Or use (T)Activator.CreateInstance(typeof(T), nonPublic: true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants