Using Mogenerator - iphone

I've have been using catagories up until now but with the start of a new project I had a look around for new toys to play with and found mogenerator.
I've managed to generate the _entity and entity files, great. But now what?
Am I supposed to put all my code in entity? Do I have to manually add all the new properties now that I cant use the generate nsmo subclass? How do I use the additional methods in _entity, must I import the _entity or the entity files or both?

So for anyone encountering the same problem.
Things seemed to be going wrong because the Entity classes should inherit from the _Entity class. I didnt pick this up from any of the guides but it seems obvious now! Then the Entity class can be a blank implementation if you like.

Related

Codegen for CoreData entity not working in Xcode 11

So I am pretty new to CoreData in Xcode and I have been looking for tutorials to see how to get more familiar with it and start working with it. A tutorial I have been watching, mentions that we need to Generate code for an entity that I created. I select Editor -> Create NSManagedObject Subclass to generate the code for the entity. But the files generated come full of errors and warnings that I haven't caused. I will attach screenshots for some more details.
That's the entity that I am creating in CoreData
That's the first generated file for the entity
That's the second file generated for the entity
The below are the errors and warnings I am getting:
File 'Person+CoreDataClass.swift' is part of module 'CoreData'; ignoring import
File 'Person+CoreDataProperties.swift' is part of module 'CoreData'; ignoring import
Only classes that inherit from NSObject can be declared #objc
Cannot find type 'NSManagedObject' in scope
Cannot find type 'NSFetchRequest' in scope
Note that I have enabled CoreData when I first created the project and I haven't made any changes to any other files in the project.
I would appreciate any kind of help since I haven't got any experience yet with CoreData. Thank you!
Try creating a new project with a different name (not CoreData)

add scaffolded item wizard cannot resolve data model class

everyone.
I'm trying to create new Scaffolded item for simple ASP.NET Wep API application which should be based on domain object class and DbContext derivative in separate assembly. The assembly is in the solution, target app has a reference to it (and manually created code which invokes the classes from my lib is build up without any errors) and, obviously, the classes I've mentioned have access modifier public.
The problem is wizard for creating new scaffolded item cannot see my model classes. (By the way, when the model classes were in another ASP.NET MVC5 app the wizard worked well.) I'm using Visual Studio 2013 Update5.
How to fix this? Any workaround would be helpful too!
Sorry for disturbing.
the origin of the problem seems to be that I've move my data model classes from ASP.NET MVC app into my class library in wrong way.
I've not just cut/paste them, but copy-paste, cut-paste (confirmed replacement).
this is the only thing which could cause the problem (although I still don't know the details).
Never the less I've started from the beginning again and cut/past the data model files initially - everything seems to work fine now.

MVC4 Scaffolding, DBContext in different assembly

I've been trying to scaffold out a DBContext class (Code first), which resides in a different assembly with the reference added to the current MVC project.
VS2012 is giving me a message that says that the DBContext is in a different assembly and that, it is not able to modify the class. I understand that it won't be able to modify the class as it is in a different assembly, but the class already has the required DBSets as fields.
The solution that comes to my mind is to create proxy DBContext in my MVC project, use it to scaffold it out and link it to the original DBcontext inside the controller.
Are there any correct/better/easier way around this? Am I missing something really obvious here?
Thank you.

How to add core data classes to a framework in iOS

I am trying to create a framework out of my existing codebase for the purpose of reuse. I have a exmaple.xcdatamodeld class which in turn contains some core data classes. I have added this entire exmaple.xcdatamodeld class into my new framework. But i am getting an error which says that some of the classes in my exmaple.xcdatamodeld are missing. (Example:classname.h file not found). Am i doing something wrong while adding the entire core data class? Can anyone help me out with my problem...
I have taken this link as a reference while creating the framework
edit : I am not getting the option of adding all the core data classes individually. It seems i can add only the complete datamodel file. PLease refer the screenshot below.
exmaple.xcdatamodeld is your data model. If it refers to any classes that you've created (which will be subclasses of NSManagedObject), you'll need to include the source files (.h/.m files) for those classes in your framework.
The .xcdatamodeld file is just the model, a serialized version of the NSManagedObjectModel. It does not contain any classes.

How do I get my Objects to work in ASP.NET MVC2

I'm rather new to MVC2 (never been in MCV1) though I'm a WebForms developer for some years now...
in my MCV 2 start project I created a App_Code folder that I would put my Business Classes on it, I also add 2 References to 2 DLLs used for the API I'm about to use.
But I don't get Intellisense on the referenced objects
What am I doing wrong?
alt text http://www.balexandre.com/temp/2010-07-28_1343.png
Is this so much different from the WebForms part?
Added
Even if I put the Object in Models instead App_Code (where I normally put all code in WebForms) I still don't get the normal intelisense, so... it just tells me that something is wrong ... dang! MVC is hard! I probably should do this in WebForms...
alt text http://www.balexandre.com/temp/2010-07-28_1509.png
This has nothing to do with MVC2, and everything to do with you're doing it wrong. I can tell that its a possibility, as you're using App_Code (I mean, who does that?). I'd definitely suggest backing up and reading some MVC tutorials, as it IS much different (although not in the way you're asking about).
I'm not exactly sure WHAT you're doing wrong, however. It might bethat PerceptiveMCAPI is internal to the assembly, it might be because there is a bug in VS, it might be that you haven't imported the correct namespace... it could be a number of different things.
I'd do the following: 1) load the assembly in reflector and make sure you have the namespace and type name and that it is public 2) use the fully qualified name of the type 3) compile, check all errors and 4) restart VS.
If all else fails, Connect.
See the Models directory -- that's where your model classes would go, assuming the class is a view model class. Having said that, it should be able to pick up and provide intellisense for whatever references you add. App_Code isn't really intended for a Web Application project (the type used by MVC) where the code is compiled statically, but rather for a WebSite where the code is compiled dynamically at runtime. It could be the "special" nature of the directory that is causing the problem because it doesn't fit the project type. You might try simply creating a different directory (if Models isn't appropriate) and not use the special App_Code directory for your code. A separate class library project with a project reference in the web application would be another alternative and is the one I usually use for non-viewmodel/controller code.