This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
still finding my way around Lightspeed.... i have an Barcodes table that contains Barcodes for Items within the Item table - 1 item can have 1 or >1 barcode. when i get the Item record, i also bring back the barcodes as an EntityCollection. These are then displayed in a ListBox for users to maintain. Am able to add new Barcodes into the collection what should i be using to store the barcodes in so that i can add/amend/delete entries (as the users amend on screen) and then pass it back to the database to update (as or if required) thnks |
|
|
Hi Mark, The exception is telling you that the entity you're working with is not currently associated with an active unit of work. I'm not familiar with the way you're working with your unit of work objects, but if you're doing something like: var barcode; using(var uow = context.CreateUnitOfWork()) using(var uow = context.CreateUnitOfWork()) You will get an exception because the barcode was retrived under what is now a disposed unit of work. You will need to attach the barcode to the new unit of work using the Attach() method in the second block above. I hope that helps and, if not, perhaps you could provide a simple repro so that I can better understand the mechanics of how you're using the UnitOfWork pattern. |
|
|
JD, thx for the quick reply yes, that is the case. i read the Item table (unitoflabour.FindOne<Item>(itemID)) and then grab the assocaited barcodes (this.mView.Barcodes = item.Barcodes; ) Used to use a DataTable before that allowed me to do this (based on DataRowState) is there an "equivalent" in Lightspeed ? thx |
|
|
Hi Mark, LightSpeed doesn't have an equivalent to a DataTable but what you're wanting to do is completely possible and exactly what you should be doing with LightSpeed. The key is simply ensuring that you're within a unit of work and that the entities you're using are attached to that unit of work. Could you post a snippet of your code showing how you're currently doing things? If it's a sizable chunk of code please email it to me: jd @ mindscape.co.nz. That way I could point you in the right direction exactly rather than talking about how the UnitOfWork operates :-) I hope that helps. |
|