StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Member name conflict with Type name.Expand / Collapse
Author
Message
Posted 06/21/2006 10:10:49 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 02/28/2007 12:59:00 PM
Posts: 15, Visits: 42
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?

Post #1609
Posted 06/21/2006 10:31:57 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
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


www.bungie.net
Post #1610
Posted 06/21/2006 10:53:55 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 02/28/2007 12:59:00 PM
Posts: 15, Visits: 42
Duh!  Thanks dude... I should have thought of renaming the BO...

Jason

Post #1616
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:45pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.