We are using a unique way of deriving Global ID's on our tables, because we have several individual locations that are now harvesting information bac to a central location. Each location has a unique Id (SalonId) and each table has an incrementor ID (Object Id) To identify this object globally we use the following code:
private long Generate(int _salonId, int _objectId) {
try {
if (_objectId < 0) {
_salonId++;
}
Int64 GlobalId = System.Convert.ToInt64(_salonId);
GlobalId = (GlobalId << 32) + System.Convert.ToInt64(_objectId);
return (long)GlobalId;
} catch (Exception ex) {
throw new Exception("GlobalId Generation failed: salonId" + _salonId + " objectId:" + _objectId, ex);
}
}
Because of a change in scope I now need these GlobalId to be used locally and genertered automatically when creating new records. The problem is I do not yet have a ObjectId unitl Save, also we need to use these GlobalId as contraint Fields.
My question is how can I create a customer Id Generator Class that can Generate these Id's and allow me to automatically create them on Save. An then support relationships and cascading?
Thank You.
Toby
|