Great!

Usually however the Id is implemented as a public (at least for get)
property of entities.

/Oskar


2014-09-17 3:25 GMT+02:00 Nguyễn Trung <[email protected]>:

> Thank all.
> i resolved my problem, i use reflection to get id of item. Does
> Sep 15
> Ricardo Peres in this class Nhibernatehelper . item is type of T. it' nt
> id to call.
>
>
>
> On Monday, September 15, 2014 10:15:10 AM UTC+7, Nguyễn Trung wrote:
>>
>> Hi all
>>
>> How i can get id entity after transaction like Save, Update and Delete.
>> Ex: Update method:
>>
>>         public void Update<T>(T item)
>>         {
>>             using (ISession session = OpenSession())
>>             {
>>                 using (session.BeginTransaction())
>>                 {
>>                     try
>>                     {
>>                         session.Update(item);
>>                         session.Transaction.Commit();
>>                         long id=??
>>
>>                     }
>>                     catch (Exception ex)
>>                     {
>>                         session.Transaction.Rollback();
>>                         throw new Exception("Can not Update !\n\b" +
>> ex.Message);
>>                     }
>>                     finally
>>                     {
>>                         session.Close();
>>                     }
>>                 }
>>             }
>>         }
>>
>> Thank all.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to