Is there a way to add comments to the entities, attributes, and relationships in the data model for Core Data? As my model becomes more complex, it would be useful to have comments, but I haven't seen any way to do this. Of course, it would also be helpful if the comments can be retained through migrations.
There is no way of adding comments directly to your Core Data model, but viewing the model in X-code you can switch to Table, Graph editor style in the lower right corner of the entity inspector. This view should serve plenty as documentation for your model if you've built it logically.
Of course you could always add a comment section in your App Delegate, covering the structure of your Core Data model, but I suppose you do know this alreay.
Related
Please pardon the long-winded title to this post.
Basically, I have an entity model that was generated by Entity Framework 5 using the Database First method. Now I would like to develop those POCO entity classes by adding validation logic and anything else I might need to go in there. The problem... (and this is so glaring I can't believe I couldn't find any answer to this on the web)... is that any time my database schema should change and I use the "Update Model from Database" command from my model diagram, the POCO classes are re-generated and all custom code is lost.
As far as I understand, the "domain model" layer in an MVVM application is largely comprised of what EF generates (in database first approach), plus validation (perhaps implementing the IDataErrorInfo. But if this was the right way to do it, why would this be wiped away when using database-first model updates?
What am I missing?
Thanks
You should use partial classes. That is why they are there.
If you want to know the basics see this short example:
http://www.dotnetperls.com/partial
Here is more on partial classes from the msdn:
http://msdn.microsoft.com/en-us/library/vstudio/wa80x488.aspx
If you want to use your own namespaces in the genarted code, you can refer to this SO question:
Entity Framework 5 partial classes not working
I'm currently in a project where I have been asked to create a logical data model in UML. Now i've defined all my logical data entities and know all my attributes i'm just a little lost on how I can map these attributes to the UI.
The point of the exercise is to prove all the attributes in the requirements have been met in the system we have chosen to deploy. Happy to supply more information.
The application I am using is Enterprise Architect.
This question was solved the Enterprise Architect Support Forums.
Connect both classes with an association
Right click the assoc. near the class with attributes
Context menu/Link to Element Feature
Attributes
-> select the one and the assoc. is attached to it
There is an elegant approach which is to use Database stereotypes in your class diagram on attributes and then map it to java ORM annotation in the code.
I don't think EA can do this ORM mapping but other tools can.
Do you have artifacts in your model for the UI, too? That is, as a screen mock up or as a class model of the underlying UI classes? If yes, then you may find it very helpful to establish a traceability for your artifacts using a realization or dependency relationship.
You can further support that by creating requirement entities (in a SysML requirements diagram) and drag'n'drop the respective requirement onto the entity which provides a solution to it. This is described on page 31 in the following EA whitepaper: http://community.sparxsystems.com/whitepapers/Requirements%20Management%20with%20Enterprise%20Architect/Requirements_Management_in_Enterprise_Architect.pdf
I made a screenshot for you of how this looks, but unfortunately I am not yet allowed to post it here since I am a new member. Maybe you can get a rough idea from this screenshot I found on the web: http://www.sparxsystems.com.au/enterprise-architect/images/traceability_lg.png
That mechanism works on class level. On the attribute level you may want to add a link to specific related (requirements) elements in the notes field, if necessary.
I am having some trouble finding the best way to set up my Core Data Model... Let me explain my current situation...
I have four entities
1)Game
2)Team
3)Player
4)PlayerStats
Each Team holds Players, and the teams play Games.
PlayerStats include things such as pointsScored,minutesPlayed,etc just basically stats that are related to things directly in a certain game.
I need to figure out where/when to insert the PlayerStats Entity in the ManagedObjectContext. Obviously each PlayerStats entity has to hold a reference back to the Player entity it came from.
The database needs to be set up such that I can go back and look at a Team then look at its players,then look at the players games it has participated in, then see that players stats for that specific game...
I'm not sure I followed that whole discussion, but I certainly got enough to offer you this advice as an answer.
Do not think of your Core Data model independently. Core Data provides complete object graph management, which includes persistence.
If I were you, I'd sit down with my design, and design the objects, their relationships, and the whole thing without even thinking about core data or a database. First settle on a proper design for all your objects, data, interactions, API, etc., etc.
Then, when you have your design, you should be able to immediately determine your entities, relationships, and attributes. Basically, if your core data model does not just obviously fall out of your design, then your design is probably lacking. Go back and iterate on your design.
You should be able to pretty much complete your entire design without even considering Core Data as much more than an implementation detail.
What is the difference between views as a stand-alone design documents and views grouped in one design document? When do you put two views in one design document? Is there any guide for this?
There's no real guide for this, as it's entirely up to you. Here are the implications as far as I can tell:
Each design document can have as many (or as few) views as you wish. Keep in mind that a view is not created or updated until it is first queried. Also, when a single view is queried, all the other views in that same design document will also be created/updated. This won't be a problem unless you have millions of documents, but it is something to bear in mind.
Also, I believe the full string value of the view is compared between revisions, so it won't rebuild a view if the name and function text are identical. (NOTE this is speculation based on what I've read about views, it's just never explicitly stated)
Generally, I've migrated towards having a "common" design document that contains a lot of the core CommonJS modules (like form validation functions) and other general settings. In addition, each "entity" in my project will have a separate design document with their own views, update handlers, validation functions, show/list functions, etc. This pattern keeps each entity and it's functions grouped together, almost like a class of sorts. I've found it is much easier to maintain and naming is a little easier when each entity is self-contained.
This is an embarrassingly basic n-tier question.
I've created a DAL project in VS2008 with subsonic. It's got a widget class, a widgetcollection class, and a widgetcontroller class.
I've created my Business logic project (no I can't put it in the same tier) that references it. Using certain business criteria, it selects a collection of widgets in a function that returns a widgetcollection.
My question is: how does my GUI layer bind the collection to a grid? I know that the widgetcollection is a valid datasource for a datagrid, but how does the GUI layer know what a widget and widgetcollection are? Surely I don't have to reference the DAL from the GUI, that negates the whole point.
Firstly, I dont think this is an embarrasingly basic n-tier question.
It is a very interesting subject and one I attempted to stimulate discussion for in the old Subsonic Forums.
I share your reluctance to expose my GUI layer to the DAL.
My GUI layer only talks to BLL using the vocabulary and topics of my own Entity Model and only returns my own entities or lists or in some cases Data Tables.
My BLL only talks to a MAPping layer which maps Fetches,Saves etc to the appropriate DAL CRUD methods and converts the returned Subsonic types to my Entity types.
In doing this I was suprised at how much of Subsonic I had to duplicate and at times I felt I was going down the wrong road, I am feeling more comfortable with it now, though it still needs refactoring and refining.
For example, finding a flexible, generic means of indicating to my BLL which row(s) I wanted returned in a fetch was a challenge I hadn't expected and I finished up writing a generic queryClass with fluent interface which looks a lot like a Subsonic Select.
FWIW, I think you are headed down the right track, I guess what you have to do though is decide how you want to define those Subsonic types to your GUI.
Rob has an interesting discussion you may be interested in.
(using SubSonic 2.x) In my BLL classes I have a property which gives an object reference to the relevant DAL class. My UI form has a reference to the BLL class, so from the form I can address the DAL properties and methods via .BLL.DAL.xxxx
FWIW, I have never managed to successfully bind a SubSonic collection to a DataGridView. As alternatives, I sometimes use the collections .ToTable() method to create a DataTable and then bind to that, or alternatively I manually bind using .AddRow()
Look at the documentation for IBindingList Interface in MSDN, it has a pretty good sample.
Create, for example, a CustomersList class in your model that uses a Customer class in your BLL. Bind the grid to an instance of the CustomersList class. The presentation layer has no knowledge of the subsonic table classes.
You probably need to use an Interface. You can easily create an interface based off of the Widget in your Dal(right click on the class and create an Interface from the class). Next take the Interface and add it to your Business Logic Layer or a seperate project just for interfaces. Once you have done that you can add a reference to the Interface both in the DAL and in the GUI. This can also help if you ever change your data storage from a Database to XML etc. etc.