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
|
Is there a way to make an entity Transient at runtime. I would like to add some child objects to an entiy but dont want them to be persisted. I am Nesting parts to purchasable lengths. but the supplier does not always have the same stock lengths. Sometimes they have odd ball lengths as a one time deal. I want to enable my users to enter these lengths in but not persist them to the database. The reason I ask is all my code is set up to handle the lengths and I could just add a transient length to the list in the same collection. Otherwise it gets a bit more complicated.(this is all very simplified of course) I have wanted this feature on a few occasions but worked around it. So since it keeps popping up I thought I would ask.
|
|
|
Just to rephrase this so as to check I've understood correctly, you basically want to be able to exclude an entity from SaveChanges, right? We've had a couple of requests for this, I think, so we will see if we can look into it. The main issue will probably be around associations (if a persistent entity references the transient entity). If I've misunderstood the scenario, please let us know! |
|
|
Yes you understood perfectly. The ability to be able to associate hybrid Trasient/Persisted data to a Persisted entity in the same EntityCollection EXAMPLE: SIZE -> STOCK_LENGTHS (where Stock_Lengths could be Transient or Persisted) |
|
|
I think I have a work around for this. if you take a look at my object I can make it Transient/Temporary so it wont get saved to the database. Mindscape let me know if there are any repercussions in doing this?
public partial class NestingLength |
|
|
I forgot to mark isTemporary as [Transient] |
|
|
I can't see any repercussions with this, though you may want to make isTemporary readonly so that you don't inadvertently modify it on an entity loaded from the database and thereby accidentally lose changes. |
|