GetIdValue in ReadOnlyBase

GetIdValue in ReadOnlyBase

Old forum URL: forums.lhotka.net/forums/t/4788.aspx


vijay posted on Friday, May 02, 2008

Hello,

I have ReadOnlyBase class but all members are of datatype string. How do i set value for variable _reportId.

protected override object GetIdValue()
{
    CanReadProperty(ReportIdPropertyName, true);
    return _reportId;
}

If i try to remove this declaration it throws complie error as "...class does not implement inherited abstract member ...". How should i set value for _reportId and should it be unique for the object.

Thanks.

sergeyb replied on Friday, May 02, 2008

In theory, ID value should be your primary key, as it was designed to uniquely identity each object inside the list.

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: vijay [mailto:cslanet@lhotka.net]
Sent: Friday, May 02, 2008 8:10 AM
To: Sergey Barskiy
Subject: [CSLA .NET] GetIdValue in ReadOnlyBase

 

Hello,

I have ReadOnlyBase class but all members are of datatype string. How do i set value for variable _reportId.

protected override object GetIdValue()
{
    CanReadProperty(ReportIdPropertyName, true);
    return _reportId;
}

If i try to remove this declaration it throws complie error as "...class does not implement inherited abstract member ...". How should i set value for _reportId and should it be unique for the object.

Thanks.



JoeFallon1 replied on Friday, May 02, 2008

You assign a value to _reportId during DataPortal_Fetch of your BO.

It should be a value which is unique (e.g. the Primary key value of the DB table or a unique index.)

Joe

Copyright (c) Marimer LLC