Integrating lookup lists with objects using toolkit

Jun 10, 2012 at 1:11 AM


I have 2 entity framework models one points to a "Master" database

The other points to a "Customer" Database

The master database contains several lookup list type tables

AccountPeriodNames ClipTypeNames

My customer database contains a clip table. The key field is ClipID, there are also AccountPeriodId and ClipTypeID fields

I therefore need to add code for GetClips

GetAccountPeriodNames and GetClipTypeNames do not need be observed they are merely for lookup purposes

AccountPeriodID 33 Maps to Account Period P324 AccountPeriodID 34 Maps to Account Period P4324

ClipTypeID 1 Maps to Base
ClipTypeID 2 Maps to Peak

If I have 2 Clip objects as follows....

ClipID 1, AccountPeriodID = 33, ClipTypeID = 1
ClipID 2, AccountPeriodID = 34, ClipTypeID = 2

I want to add 2 new properties (not to be saved to database) AccountPeriodName and ClipTypeName

When the clips have been read from the database I need to then set the 2 new fields according to their lookup values

Can someone show me how to do this in using the toolkit for ria services please? Please note that I am dealing with lists here, not single objects

The idea is that when my Clips View links to its ViewModel, the Clips property of the view model will contain the data from the database, as well as the lookup text values

So in the example above I would get 2 Clip objects

ClipID 1, AccountPeriodID = 33, ClipTypeID = 1, AccountPeriodName=P324, ClipTypeName=Baseload
ClipID 2, AccountPeriodID = 34, ClipTypeID = 2, AccountPeriodName=P4324, ClipTypeName=Peak

Also, due to issues with the components I have to use, I converters are not an option