StrataFrame Forum

Overide enum for BO

http://forum.strataframe.net/Topic12902.aspx

By Shivji Patel - 12/4/2007

Hi

I have any old Database that has used current reserved codes ie 'private' and 'ref' in c csharp.

Is there any way to overide the enum generated for the fields in the BO

eg see items in red, i can use the custom code to overide the field and replaced private with privatex and ref with refx

and that works fine but can not find a way to overide the enum for the fieldnames.

/// <summary>
/// Contains all of the field names that belong to the business object.
/// </summary>
/// <remarks></remarks>
public enum actionsBOFieldNames
{
code,
creaop,
creadate,
creatime,
modiop,
modidate,
moditime,
delop,
deldate,
deltime,
deleted,
company,
contact,
acttype,
summary,
filename,
sent,
startdate,
starttime,
enddate,
endtime,
length,
extra1,
extra2,
extra3,
extra4,
extra5,
extra6,
extra7,
extra8,
extra9,
extra10,
template,
status,
private,
topic,
plandur,
actudur,
show,
revdate,
ref,
acamount6,
acanal1,
acanal2,
sitecode,
cop_site,
mop_site,
dop_site,
co_site,
cn_site,
att_site,
tmpl_site,
stat_site,
ref_site,
an1_site,
an2_site,
company2,
contact2,
co_site2,
cont_site2,
pathid,
importcode,
importno,
actuser,
staticaction,
viewcode,
invoicenum,
invoicedate,
CUSTOM_FIELD
}

Thanks for any help

Shivji

By StrataFrame Team - 12/6/2007

It wouldn't do it properly without a change to the BOMapper.  But, what you could do is change your custom code so that the name of the properties are @private and @ref rather than privatex and refx... that will allow you to keep the explicit names.  The @ in C# tells the compiler to keep that name no matter what.  After that, you won't have to worry about using the @ again... because you can type "this.private" or "bo.private"  If you ever have to reference the field without a reference qualifier, then you'll just use the @ again.

So, you can do the same within the enum... just add a @ in front of the two values that are causing problems; however, since there is no custom code for the enum, you'll have to remember to re-add the @ each time you re-generate that partial class (which would be hard to forget since it won't compile Wink).

By Shivji Patel - 12/7/2007

Thanks for the advice Ben, i will try that and let you know how i get on

Shivji