Member name conflict with Type name.


Author
Message
Jason Stevenson
Jason Stevenson
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 15, Visits: 43
I am wrapping up my first project with Strataframe.  I am now remapping to the production database, and have discovered what appears to be a bug...

I have a SQL databse with a Table named: DealerType.  That table contains a column named: DealerType.  So the generated class wont compile because the Member name cannot be the same as the Containing Type name.  Here are some snippets of generated code:

namespace DealerLocatorAdmin

{

public partial class DealerType : MicroFour.StrataFrame.Business.BusinessLayer

{

/// <summary>

/// DealerType

/// </summary>

/// <remarks></remarks>

[Browsable(false),

BusinessFieldDisplayInEditor(),

Description("DealerType"),

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public System.String DealerType

{

get

{

return (System.String)this.CurrentRow["DealerType"];

}

set

{

this.CurrentRow["DealerType"] = value;

}

}

Any ideas on how to work around this?


StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Jason,

The problem is with C# only.   You cannot create a member that has the same name as the containing type because only the constructors are allowed to have the same name as the containing type.  What you'll need to do is:

1) Copy the DealerType property from the .designer.cs file. 

2) Then go to the Business Object Mapper and customize the DealerType field on the business object. 

3) Choose the "Use Custom Code" option and paste the copied code into the "Custom Code" window at the bottom. 

4) Then, simply change the name of the property from "DealerType" to "DealerTypeName" or "DealerType2" or something that is unique from the name of the class. 

Or, you could simply rename your business object from "DealerType" to "DealerTypeBO" or "DealerTypeBizObj" or something that will allow the object to continue to use the property name of DealerType.

Those are about your only options.  Hope that helps Smile

Jason Stevenson
Jason Stevenson
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 15, Visits: 43
Duh!  Thanks dude... I should have thought of renaming the BO...

Jason

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search