MVC4 Add controller error - entity-framework

When I try to add a controller to my WebUI I get the following error:
'DTO.Games' is not part of the specified 'DAL.GamesEntities' class, and
the 'DAL.GamesEntities' class could not be modified to add a
'DbSet<DTO.Games>' property to it. (For example, the
'Dal.GamesEntities' class might be in a compiled assembly
I searched a before asking here but none of the solutions online helped me. I'm working DBFirst. Any code that could help solving this: ask and you shall receive.
Thanks in advance
CODE
Games.Context.cs (contains GamesEntities) - http://pastebin.com/rL9U2eTp

Related

Class 'ToolPanelComp' incorrectly implements interface 'IToolPanel'. Property 'init' is missing in type 'ToolPanelComp'

We are trying to use the enterprise version of ag-grid, but we have this error message. Thanks in advance.
ERROR in
node_modules/ag-grid-enterprise/dist/lib/toolPanel/toolPanelComp.d.ts(4,22):
error TS2420: Class 'ToolPanelComp' incorrectly implements interface
'IToolPanel'. Property 'init' is missing in type 'ToolPanelComp'.
I believe the error is resulting when trying to migrate to their latest v18.
Your problem might be solved with the help of their documentation. Please follow the below link and look for breaking changes:
https://www.ag-grid.com/ag-grid-changelog/?fixVersion=18.0.0
I guess your problem can be related to Ag-1800 specifically.
Hope it helps!

Getting error "self constructor arguments cannot reference unconstructed this" only if class is same name as class file

In a nutshell, if I define a constructor in a class thats named after the same name as the file itself, it returns the following area.
Some example code. Take the filename as ParseWebsiteData.scala for both.
This returns an error.
class ParseWebsiteData(url:String) {
}
This however, works fine.
class Foo(url:String) {
}
The only thing that I'm seeing as the issue are parser bugs from 2013, but this is the latest version of Eclipses's Scala IDE setup so I'm strongly thinking this is not the case, but turns out I'm wrong. Oops :(
As it's still an issue, what are the way(s) to avoid this occurring as I code in the future?
Well, can't tell the root cause but I was getting the same error in Scala Eclipse editor and I just did "project->clean" and it was gone!

What to import to use Lift's FieldTransform

I just started using Lift's Wizard/LiftScreen classes and need to add placeholder text to my text fields. I found the FieldTransform class as a solution to this here
https://groups.google.com/forum/#!topic/liftweb/x_t9rvvZ8jk and here http://comments.gmane.org/gmane.comp.web.lift/59985
But now I'm trying to use that information, but can't for the life of me figure out what import statement is needed (where the class is, in the libraries).
Lift 2.5-M3 talks about the API changing liftweb.net/25_m3, but nowhere do I find the class actually listed in the API (liftweb.net/api/25/api/#package).
What's the import I need? How should I be looking this up; I'd like to know how to find a class quickly next time.
EDIT:
To be a good Stackoverflow citizen, here's some code.. :-)
object WizardExample extends Wizard {
val screen1BrandInfo = new Screen {
val brandName = field("Name", "Mike")
}
}
I'm trying to add HTML5 placeholder text to the "Name" field so the user sees sample text when they view the page.
RESOLUTION:
Wow, that was my first StackOverflow. I'm blown away by what I've learned from you guys in a few hours!
#jcern: thanks for all your help. I'm working in Lift 2.4, so initially I didn't find FieldTransform in Wizard$Screen, then I clicked on the link you provided (2.5) and saw it. What a jungle to navigate! Thanks for all your help. I now see how to navigate all this. And thanks again so much for the "All" view hint. That was critical!
#Vasya Novikov: Thanks so much for this answer. This is what I'll have to do since I'm working in 2.4 and don't have access to FieldTransform.
The two best places to find classes in Lift are either in the API:
http://liftweb.net/api/25/api/#package
Or, directly in GitHub (where you can search for classes and for text/definitions within them):
https://github.com/lift/framework
As for the FieldTransform class, that should be available to any class that extends LiftScreen. See the API here -- you may need to toggle the visibility to All to see FieldTransform as it is a protected class.
You can import LiftScreen with:
import net.liftweb.http.LiftScreen

Duplicate interface definition for class SBJsonBase?

I added the Facebook sdk code to my project then I got this error because I already had a json library, so I deleted the Facebook json library from my computer and from the project but I still get this error. I search the whole project for "#interface SBJsonBase" and I only get one result. How can it say it's a duplicate when I only have one interface? Is it including the file twice? Does the search not always find everything?
May be this helps? Delete your derived data and do a clean project, then try to build again
I had a simular problem. It was a small search, but I could solve it without creating a new project etc...
The thing was I had a Class B that was importing Class A.
Then I had a class that imported Class B and also Class A.
When I did this, these problems occured.
Eg. A SOAP webservice Class imports all the Entities that are passed over the web.
Class goToSchoolWebservice.
import "person.h"
import "school.h"
...
Then I had a Singleton class used for caching that had the Logged in Person and also a ref to the webservice class.
import "person.h"
import "goToSchoolWebservice.h"
--> this is where is went wrong!!
So watch out for these circular references. ITs not so easy to detect them!
if your using #include instead of import then use this technique to minimize duplicates: at the begining of your interface (actually right before it) do check for a definition and if not defined then define it and proceed to define your interface. here is an example:
#ifndef __NetworkOptionsViewController__H // check if this has every been imported before
#define __NetworkOptionsViewController__H
#import "blahblah.h"
#interface NetworkOptionsViewController : UITableViewController
{
NSMutableArray* somevariable1;
int somevariable2;
}
#end
#endif
-- for me personally, i got this error though because the file path to my class was wrong. I checked file inspector and my class file was not defined in Classes folder even though the IDE said it was. I deleted them and copied them over again.
For those that still get this error, despite following header import conventions: I got this error from importing a header that had been deleted from the project. The missing header was instead found in an old backup of my project in dropbox (That I made before doing some destructive stuff in Git), and that file caused the circular import.
I solved a similar problem by moving all the imports to the prefix header file.

StructureMap cannot find GenericRepository

In MVC 2 I am working on something and have ran into a snag. I got my repository put instead of putting in the same class the interface is I have it same project as the EDMX file.
Initializing StructureMap is what's killing me at this point. Here's where I'm initizing StructureMap (in Global.asax.cs.)
ObjectFactory.Initialize(x =>
{
x.ForRequestedType<IUnitOfWorkFactory>()
.TheDefaultIsConcreteType<EFUnitOfWorkFactory>()
.CacheBy(InstanceScope.HttpContext);
x.ForRequestedType(typeof(IRepository<>))
.CacheBy(InstanceScope.HttpContext)
.TheDefaultIsConcreteType(typeof(GenericRepository<>));
});
The Namespace for this project is GpdsCreationTaxidermy.Data (which is the same Namespace as my GenericRepository.cs). I would post the code for this file but I dont believe that is the problem here. In my Global.asax I import the proper Namespace
using GodsCreationTaxidermy.Data;
The error I'm getting is:
Error 3 The type or namespace name
'GenericRepository' could not be found
(are you missing a using directive or
an assembly reference?)
Also attached is an image showing this particular projects layout
Can someone help with this issue, or what I'm doing wrong here
EDIT I have even tried adding GodsCreationTaxidermy.Data to the file name and still no luck.
Thanks for sending the files :-)
It looks like the definition of GodsCreationTaxidermy.Data has changed.
This is what I did to fix the problem:
Remove these references from GodsCreationTaxidermy.Data.Repository Class Library:
GodsCreationTaxidermy.Data
GodsCreationTaxidermy.Data.Repository
Remove these references from GodsCreationTaxidermy.Data Class Library:
GodsCreationTaxidermy
GodsCreationTaxidermy.Data
Remove the reference to GodsCreationTaxidermy.Data in the GodsCreationTaxidermy MVC project and re-add the reference, choosing GodsCreationTaxidermy.Data from the Project tab
Hopefully that'll get the GenericRepository working :-)
I did notice that the following line no longer works though:
EFUnitOfWorkFactory.SetObjectContext(() => new GodsCreationTaxidermyEntities());
GodsCreationTaxidermyEntities doesn't seem to exist in GodsCreationTaxidermy.Data any more. Does that cause you an issue?
Try this:
.TheDefaultIsConcreteType(typeof(GodsCreationTaxidermy.Data.GenericRepository<>));
Possibly remove <> after GenericRepository. Has GodsCreationTaxidermy.Data been added to the MVC site as a reference?