Getting ambiguous reference when building AdventureWorksModel

Dec 16, 2012 at 12:54 PM

I'm getting a bunch of errors of the form

Error    1    'MaxLengthAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.MaxLengthAttribute' and 'NakedObjects.MaxLengthAttribute'    Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Person\Address.cs    57    10    AdventureWorksModel

Anyone know what I'm doing wrong or how to debug this.

I'm using Microsoft Visual Studio Express 2012 for Web

Coordinator
Dec 16, 2012 at 1:36 PM

You're not doing anything wrong.  We introduced our MaxLength attribute a long time ago, then Microsoft introduced theirs with the same name!  We have since obsoleted ours in favour of theirs  -  but either is recognised.  So just namespace it i.e. wherever you get the ambiguity, just explicilty say e.g System.ComponentModel.DataAnnotations.MaxLength.

I'll make a note to update the AdventureWorksModel for the next release, so that the ambiguity messages don't appear.

Dec 23, 2012 at 12:26 PM

Many thanks that fixed that problem

I’m seeing a few other issues

1>Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Models\AccountModels.cs(81,9,81,31): error CS1070: The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

1>Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Models\AccountModels.cs(86,26,86,44): error CS1070: The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

1>Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Models\AccountModels.cs(92,41,92,59): error CS1070: The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

1>Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Models\AccountModels.cs(109,16,109,38): error CS1070: The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

1>Q:\mwoodpatrick\NakedObjects\Projects\AdventureWorksModel\AdventureWorksModel\Models\AccountModels.cs(159,48,159,70): error CS1070: The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

Where is MembershipCreateStatus defined I did a find on the code and did not see where it was defined

Thanks in advance

Mark

Coordinator
Dec 23, 2012 at 12:34 PM

Mark

Stef and I have both finished for the Christmas to New Year period, so I'm not going to investigate your issue right nwor.  Given that its on the AccountModels  (probably just a versioning of MVC  issue) I suggest you just take out all the authorization attributes off the controllers and run it without authorization.  Hope that will help.  Otherwise you might have to wait a week or so.

Best wishes for Christmas.

Richard

Coordinator
Jan 4, 2013 at 11:24 AM
Edited Jan 4, 2013 at 11:26 AM

Are you up and running now, Mark?

Incidentally, going back to your posting at the start of this thread  -  are you using the latest download of the AW Model?  Because I can't find any reference to MaxLength in that code  -  I think that it was replaced by StringLength throughout.