Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> DataAdapter.FetchEntityUsingUniqueConstraint
 

Pages: 1
LLBLGen Pro Runtime Framework
DataAdapter.FetchEntityUsingUniqueConstraint
Page:1/1 

  Print all messages in this thread  
Poster Message
BeauButton
User



Location:
New Orleans
Joined on:
13-Oct-2004 22:17:44
Posted:
5 posts
# Posted on: 19-Nov-2004 16:44:29.  
Hello Everyone, I ran into a minor problem when using the FetchEntityUsingUniqueConstraint method of the DataProvider. I've read through the majority of the forum posts and i have not seen anyone post about this (nor did i find anything in the help document).

When i use FetchEntityUsingUniqueConstraint and a row that matches the constraint is found in the DataBase everything works fine. However if a row is not found that matches the constraint i get a "new" Entity (.IsNew = true), but when i attempt to use it in code i get an entity out of sync exception.

Is there something i need to do in order to use the "New" entity (it does not exist in the database and i do not want to save it immediately, only when the user clicks a save button). My work around for this has simply been to check ".IsNew", if it is true then i simply reinstantiate the entity.

Any insight would be great, i've got the solution working but i'd really like to know if there is something else i should be doing.

Thanks!
[BeauLButton()]  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37830 posts
# Posted on: 20-Nov-2004 10:49:07.  
new entities by design can't be used to read data from, as they don't exist yet. To ease development, a new entity is returned, not 'null'. To use it, you have to set values to it and save it. So you can better check if the method returns true (succeeded) or false (not succeeded). Based on that result, follow the path of creating a new instance or using the entity fetched.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
BeauButton
User



Location:
New Orleans
Joined on:
13-Oct-2004 22:17:44
Posted:
5 posts
# Posted on: 22-Nov-2004 17:42:06.  
Thanks! Much Appreciated . . .
[BeauLButton()]  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.