|
|
Matthew Bryan 2010-05-19, 00:10
I'm having trouble setting up an IDMigrator. I start to write a DataModel class with the overrides that do the translation through an IDMigrator...but that technique doesn't provide a straightforward path for the initialization of IDMigrator....unless I'm reading the db or file natively before it's abstracted in the interface. Is this how folks are doing it or am I missing something? Is there any sample code for an IDMigrator implementation? Thanks for the help....this is a great list for an exciting tool.
Matt
Sean Owen 2010-05-19, 08:33
Ideally, you initialize by pre-loading all the mappings, by calling initialize(). You can also call storeMapping() whenever you know you have a new mapping -- on each translation if you like, though that's a lot of overhead.
Then you just use it to translate strings to numbers and back. The only twist comes when, for example, you have everything in a DB, and have to translate from numbers back into strings to make efficient queries. Then you have to override some methods in the DataModel implementation to deal with this.
It's not one line of code but not terrible, and maybe we can find ways to make it easier.
On Wed, May 19, 2010 at 1:10 AM, Matthew Bryan <[EMAIL PROTECTED]> wrote: > I'm having trouble setting up an IDMigrator. I start to write a > DataModel class with the overrides that do the translation through an > IDMigrator...but that technique doesn't provide a straightforward path > for the initialization of IDMigrator....unless I'm reading the db or > file natively before it's abstracted in the interface. Is this how > folks are doing it or am I missing something? Is there any sample code > for an IDMigrator implementation? Thanks for the help....this is a > great list for an exciting tool. > > Matt >
Matthew Bryan 2010-05-20, 13:48
Thanks Sean, I think I've got the recommendations working! I created a new DataModel that initializes the IDMigrator and has overrides for getLongColumn and setLongParameter that pass data through my IDMigrator. Now the only thing I'm missing is a way to retrieve the string names of items through the web service. Are there any hooks on that side where I can make the ID translation?
Thanks again!
Matt
On Wed, May 19, 2010 at 4:33 AM, Sean Owen <[EMAIL PROTECTED]> wrote: > Ideally, you initialize by pre-loading all the mappings, by calling > initialize(). You can also call storeMapping() whenever you know you > have a new mapping -- on each translation if you like, though that's a > lot of overhead. > > Then you just use it to translate strings to numbers and back. The > only twist comes when, for example, you have everything in a DB, and > have to translate from numbers back into strings to make efficient > queries. Then you have to override some methods in the DataModel > implementation to deal with this. > > It's not one line of code but not terrible, and maybe we can find ways > to make it easier. > > On Wed, May 19, 2010 at 1:10 AM, Matthew Bryan <[EMAIL PROTECTED]> wrote: >> I'm having trouble setting up an IDMigrator. I start to write a >> DataModel class with the overrides that do the translation through an >> IDMigrator...but that technique doesn't provide a straightforward path >> for the initialization of IDMigrator....unless I'm reading the db or >> file natively before it's abstracted in the interface. Is this how >> folks are doing it or am I missing something? Is there any sample code >> for an IDMigrator implementation? Thanks for the help....this is a >> great list for an exciting tool. >> >> Matt >> >
Sean Owen 2010-05-20, 13:50
You could use the IDMigrator on the client to map longs back to Strings, which I bet is infeasible.
So you could also just add more methods to the web service, and/or overwrite the ones that are there, to deal in Strings and then use the IDMigrator internally to translate.
On Thu, May 20, 2010 at 2:48 PM, Matthew Bryan <[EMAIL PROTECTED]> wrote: > Thanks Sean, I think I've got the recommendations working! I created a > new DataModel that initializes the IDMigrator and has overrides for > getLongColumn and setLongParameter that pass data through my > IDMigrator. Now the only thing I'm missing is a way to retrieve the > string names of items through the web service. Are there any hooks on > that side where I can make the ID translation? > > Thanks again! > > Matt > > On Wed, May 19, 2010 at 4:33 AM, Sean Owen <[EMAIL PROTECTED]> wrote: >> Ideally, you initialize by pre-loading all the mappings, by calling >> initialize(). You can also call storeMapping() whenever you know you >> have a new mapping -- on each translation if you like, though that's a >> lot of overhead. >> >> Then you just use it to translate strings to numbers and back. The >> only twist comes when, for example, you have everything in a DB, and >> have to translate from numbers back into strings to make efficient >> queries. Then you have to override some methods in the DataModel >> implementation to deal with this. >> >> It's not one line of code but not terrible, and maybe we can find ways >> to make it easier. >> >> On Wed, May 19, 2010 at 1:10 AM, Matthew Bryan <[EMAIL PROTECTED]> wrote: >>> I'm having trouble setting up an IDMigrator. I start to write a >>> DataModel class with the overrides that do the translation through an >>> IDMigrator...but that technique doesn't provide a straightforward path >>> for the initialization of IDMigrator....unless I'm reading the db or >>> file natively before it's abstracted in the interface. Is this how >>> folks are doing it or am I missing something? Is there any sample code >>> for an IDMigrator implementation? Thanks for the help....this is a >>> great list for an exciting tool. >>> >>> Matt >>> >> >
|
|