Recently I have migrated to EF6 alpha 3 and when I use EF Power Tools Beta 3 for "Generate Views" for my context to get faster startup , I get this error message :
---------------------------
Exception has been thrown by the target of an invocation.
---------------------------
I was using it before migration without any problem.
Any suggestions? Thanks in advance...
If you are using code first approach then make sure your DbContext class must have a public parameterless constructor.
Related
I want this in hybris project. i have added dependencies and plug in pojogen-maven-plugin for 4.6.0 version. But I get error for Navigation property in EDMX.
Invocation of method 'getNavigationType' in class org.apache.olingo.ext.pojogen.V4Utility threw exception
java.lang.NullPointerException at entityType.vm
Please not none of my entity types in EDMX have navigation property as key .
There could be a couple of things that could go wrong here like.
The Navigation property you have defined might not be correct or there could be a bug in the V4Utility class itself.
What I would recommend is that you debug the code with other projects that do something similar. e.g. OData to OpenAPI converter or OpenAPI.NET.OData Converter. You can try parsing your $metadata EDMX with these tool. If they can its most likely a bug in the V4Utility class itself
I am trying to migrate some existing code from MVC5 to MVC6 and I am having difficulty with this particular code:
Engine.Razor.RunCompile(File.ReadAllText(emailTemplatePath), "emailTemplateKey", typeof (EmailViewModel), emailViewModel);
I am receiving the following runtime error:
MissingMethodException: Method not found: "Void Microsoft.AspNet.Razor.CodeGenerators.GeneratedClassContext.set_ResolveUrlMethodName(System.String)". in RazorEngine.Compilation.CompilerServiceBase.CreateHost(Type templateType, Type modelType, String className)
The original code I was using in MVC5 was taken from here. If there is no way of converting the above code to work with MVC6 what is another elegant way of doing email templates?
Apparently there has been a change in GeneratedClassContext class - the property ResolveUrlMethodName does not exist anymore, hence the MissingMethodException. Looks like ParserContext class has changed too, since accessing OnError event handler throws the same exception.
In fact it is the setter of the missing property missing (pardon the expression!), which, being a method, causes the exception. Absolutely accurate but somewhat misleading, unless you recall this.
Quite a similar question (and a good answer with alternative solution!) here: RazorEngine and MVC 6 beta 7.
I wonder what's going on here...
I just created a new, empty F# Console application in Visual Studio 2013 (using F# 3.1 and .NET 4, FSharp.Core Version 4.3.1.0) and added the Reactive Extensions Main Library using Nuget: Install-Package Rx-Main
Now check this out:
This works and the hovering over test shows val test: unit -> System.Reactive.Subjects.Subject<'a>. As expected. Then I added the new keyword.
Interesting. Does anybody know why adding the new keyword breaks the code? For reference, if you additionally specify the type parameter, it works:
I can't find a spec reference off-hand, but when using new explicit type args are required. You need to do:
let test() = new System.Reactive.Subjects.Subject<_>()
It appears to be a static class, and static classes cannot be newed up.
http://msdn.microsoft.com/en-us/library/system.reactive.subjects.subject%28v=vs.103%29.aspx
And to elaborate on your specific error message, it means there is public no constructor available that accepts 0 parameters. As far as I know, static classes only have private, parameterless constructors.
I am trying stuff out on MVC4 Beta. Project is in VS11, EF 5.0-Beta, using Code First approach.
Created simple Model poco and DbContext derived class with single IDbSet<> property for model class. Connection string with LocalDb.
I noticed when context's Entity Set property is type of IDbSet<> then I get message from VS when I try to create new controller with “Controller with read/write actions and views, using Entity Framework” Scaffolding template:
"There was an error generating 'MyProject.MyNamespace.MyContext'. Try rebuilding your project."
Even Clean Solution and building again doesn’t help.
If I changed Entity Set property to type DbSet<> then controller scaffolding succeeds.
Is it a bug or is it expectable?
Br,
Lauri
It is not a bug you cant instantiate an instance of an Interface. The I in front of IDbSet denotes the type as an interface (By convention). So you were trying to create an instance of that interface. Instead you need to delcare it with DBSet<> which is an implementation of the IDBSet<> interface. I hope this clarifies your issue.
My original project is in Asp.net MVC 2.
I convert my project to MVC 3 without problem.
In the same time, I install the EntityFramework 4.2. Again without problem.
Were it's begin to be complicated is when I add the T4 Generate DBContext.
Thats create me the T4 properly and generate all my entity into his own "POCO Class". Thats perfect!.
When I Build my project, I Got about 400 error. Here is some example.
'mvn.Models.DBEntities' does not contain a definition for
'AddToLeaseConditionInfos' and no extension method
'AddToLeaseConditionInfos' accepting a first argument of type
'mvn.Models.DBEntities' could be found (are you missing a using
directive or an assembly reference?)
As you can see here, the context.AddToLeaseConditionInfos(objCondition); doesn't work anymore.
Same for the DeleteObject context method.
context.ConvertionUnits.DeleteObject(MyObjConvertionUnit);
Someone has an Idea.
Thanks a lot.
You previously used ObjectContext API and default code generator (or EntityObject T4 template) but now you are trying to use DbContext API with POCO DbContext T4 Generator. Those two are completely incompatible because they represent different API. You must use the same code generation approach as you used in EFv4 (which means upgrade will not give you almost any additional value) or you must rewrite your current data access code to use new API.