all.
I am using entity framework and I am trying to add three new tables to my context. The problem is, I go to "Update Model From Database", select the tables and after the new tables are added in the context, my entities which refer to views, they lose mapping!
Then, I click on the entity, then on "Mapping Details" and when I click on "Maps to" I cannot see the views anymore, only the tables.
Where did the views go? Why did they lose the mappings? What do I do to solve this issue?
Best regards.
I still do not know why the views vanished when I updated my data model, but now I got my solution working.
What I have realized is that even if I created a new context and added only the views, they were not added! (Still I don't know why).
What I did to solve this issue was: I copied the XML file, where I had all my views, tables, etc. Then, I updated my context, adding the tables I needed. After that I edited the new XML file, adding the views' code.
This solved my issue. It's not ideal, but it solve.
Related
Typically I build up the models, then loop back and put the relationships in. It seems that I cannot do that in the GUI. I also cannot create a model without a migration, and then create the migration once I've 'fine-tuned' the model. Any advice? I also noticed that CRUDs is greyed out in the menu at the top. Is it possible I loaded something incorrectly?
-Regards
I am using Entity Framework Tools 6 to pre-generate views for my EDMX model. Everything looks great and compiles, however I don't see actual difference. Breakpoints anywhere in views file doesn't get hit.
I also tried to change model and it should not work without re-generating views but it does. That makes me think those views is not getting used and I'm not sure why.
I cross-checked with article mentioned here: EF6 don't use pre-generated views but all looks good.
EDIT: Tried the same with another non-DevForce EDMX and it works as expected. So, it's a question on how to enable those pre-generated views for DevForce context
I have a strange problem in JDeveloper 10g.
Some forms I can't see in View window, and therefore I can't select and edit properties in Poperty inspector, also in UI complete structure is missing.
Besides that form is working OK.
This one is OK.
How can I resolve this without the need for re-creation od forms?
Make sure you have the JBinit method in place. Compare a working form to a non-working one.
Problem was resolved with this changes.
I don't know yet what caused this form to be erroneously created.
//JScrollPane scPane = new JScrollPane(dataPanel); //This was surplus
//topPanel.add(scPane, BorderLayout.CENTER); //This was surplus
topPanel.add(dataPanel, BorderLayout.CENTER); //This was missing
Warning: This is my first IPhone Application and I'm new to Objective C, therefore my question might be very basic.
Actually I have a conceptual problem:
I have a one to many relationship between my NSObjects Project and WorkTime (Project<-->>WorkTime). WorkTime has attributes like startDate, endDate, … and a relationship named project to the Project object.
On the UITableViewController subclass that shows my list of WorkTimes, I fetch the CoreData Model with a FetchedResultsController. When I create a new WorkTime, I use a second context and merge it with the "default" once, once the user has clicked on "save" on the drill-down View, like in the CoreDataBooks example from the Apple Documentation. That works well.
The problem starts when I set the relationship. Since the projects are in the “default” context, I can’t assign any project object to the project key in WorkTime, since they are in two different contexts.
So, should I copy all the projects into the “saving” context? Or should I use just one context for everything?
One problem that arises when I use only one context is that the tableview that shows the WorkTimes gets actualized when the user clicks on the addbutton (insertNewObjectForEntityForName). So the list grows right before it presents the new view controller (addWorkTimeDetail) in modalviewcontroller. And if the user clicks cancel in that detail view and decides not to save the WorkTime, I’d have to delete the newly created entity from the context. I don’t think this sounds the way to do it.
Suggestions would be very appreciated!
UPDATE
I'm still having some issues:
When the AddWorkTimeViewController is created from the RootViewController, I create a new NSObject WorkTime. When the user clicks "cancel" I delete the newly created WorkTime and return to the RootViewController. The FetchedResultsController actualizes the tableView and I see a short animation that comes because the object has been deleted. That's doesn't look nice.
I know it would be better to create the object ONLY if the user clicks "save" and by "cancel" do nothing, but I need that object in order to populate the drilldown views with values. The drilldown views work with a NSManagedObject. I see two possible ways to solve this:
1) Have a temporary object TempWorkTime subclassed from NSObject with the same attributes from the WorkTime NSManagedObject. I would create the TempWorkTime in the AddWorkTimeViewController and use it for the drilldown views. I would of course have to subclass them to accept an NSObject instead of a NSManagedObject. I guess type casting wouldn't work. When the user clicks "save", I would create a WorkTime NSManagedObject and pass it the values from the TempWorkTime.
2) Is it possible to trick the FetchedResultsController so that it doesn't update itself while the tableView is not visible? In that case, it would not respond to the changes in the context until it's back in view, and so it would not do the delete animation.
Any suggestions?
SECOND UPDATE - maybe it's useful for people trying to do this same thing
I found this link which proved to be very helpful:
http://www.timisted.net/blog/archive/multiple-managed-object-contexts-with-core-data/
It's very well explained why it's sometimes a good idea to use two contexts. I had some problems with using one context explained in the UPDATE part of my question.
Now I'm using two contexts and it works perfectly, even with relationships. Important is to use the NSManagedObjects of the second context when creating the relationship. That was my mistake when I started to work with this approach.
I don't see why you use two different contexts.
The way to do it is to pass your tableView's context to addWorkTimeDetail, and add any new WorkTimes to that context. If the user cancels, i.e. doesn't create a new object, there will be nothing new in the list when you return. If the user creates the new WorkTime in the context it was passed, it will show up in the list when you return.
In your example, use only one context, and pass it along to your subviews.
I found this link which proved to be very helpful:
http://www.timisted.net/blog/archive/multiple-managed-object-contexts-with-core-data/
It's very well explained why it's sometimes a good idea to use two contexts. I had some problems with using one context explained in the UPDATE part of my question.
Now I'm using two contexts and it works perfectly, even with relationships. Important is to use the NSManagedObjects of the second context when creating the relationship. That was my mistake when I started to work with this approach.
I have a few views in my database that im using in my ASP MVC-application. Now I am experiencing a very strange problem. There are 8 views in the database but even if I check them all in the Create Enity Data Model-guide only 7 of them are available as objects in the datacontext.
If I try to import ONLY the view that gets left out I get an empty model.
Is there some kind of limitation that I dont know of? Or is this a known problem?
Sounds like there is something special with this view. Things to check:
Are the rights the same on this view as others?
Try running a select on this view from query manager to confirm that it works
Open up the "empty" model in an xml view and see if there are any error messages in it
I have ran into issues importing tables and views with no key defined. The entity framework will try to assign one automatically if it can, but if you have duplicate data you may have to create a primary key before EF will bring it in.
That didnt do the trick. I removed all joins from the view definition and added a very simple view (basically just a select from a single table). That worked. Then I added the joins one by one and made the view more complicated for each step. Now I have the same view as I had before I started this process and I can now import it without problems. Something is strange in the state of Denmark