Re: SOLVED: Programatically manipulating an xcdatamodel package?
Re: SOLVED: Programatically manipulating an xcdatamodel package?
- Subject: Re: SOLVED: Programatically manipulating an xcdatamodel package?
- From: Allen Cronce <email@hidden>
- Date: Sat, 7 Jun 2008 07:31:38 -0700
On Jun 7, 2008, at 6:54 AM, I. Savant wrote:
Once I've got the modified mom file, I manually import it back into
a clean data model using Xcode. At this point, the updated model
can be viewed or edited using Xcode's data modeling tool.
First, please don't cross-post between lists.
Sorry. Originally I posted on the Xcode users list and didn't get a
response. Then I posted on Cocoa dev, and also got no response. When I
solved the problem, I thought it would make sense to post the solution
once on both lists. The problem kind of spans both Xcode and Cocoa
anyway.
Second, what manipulations are you doing? Just curiosity on my part.
<OT_Mode>
We're building a cross platform, lightweight services interface on top
of an SQLite3 database. To do that, we automatically generate LiteSQL
and Thrift code using mogenerator and custom templates. This lets us
query objects from the database and send them over the wire to a
client, who may be written in C++, C#, Cocoa, Java, python, perl, and
many other languages.
The problem is that Thrift versioning requires consistent ID's on a
per element basis. This means that when we generate the Thrift config
file for an entity, each attribute and relationship should end up with
a consistent identifier.
Dynamically generating these ID's using the index value available to
the mogenerator template doesn't work in the long run because any time
someone modifies the model, it could change the ID's for "downstream"
attributes and relationships. The result of this would be versioning
problems across the Thrift interface.
To solve this issue, we're storing the Thrift ID for each attribute
and relationship in "user info" key/value pairs in the model. At
mogenerator time, the custom template finds the Thrift ID for each
attribute and relationship and incorporates it into the resulting
generated Thrift config file. A "high water mark" ID value is stored
on a per-entity basis so that we can use it to determine the next
available ID.
We have a pretty large model with lots of properties. Manually editing
the model to set these Thrift ID values via the Xcode modeling GUI
would be tedious and error prone. The tool I wrote allows us to
programmatically reset or update these thrift ID values during
development. It was easy to write the tool using the mogenerator
sources as an example.
</OT_Mode>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden