1

I have a Data Models--created by Linq2SQL Class Diagram tool--in another assembly (Class Library Project) and I created another one

Here it is:

public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged
{

    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    private int _ID;
    private string _FirstName;
    private string _LastName;
    private string _Email;
    private System.DateTime _DOB;
    private string _PhoneNumber;
    private bool _Activated;
    private bool _Suspended;
            //..
}

In my Web Project, I created another one with the same name as partial:

  public partial class Customer
  {
    //It will have MetadataTypeAttribute for validation.
  }

I am using same namespace for them so they should be fine however, when I make View as Strongly typed using Customer object:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Customer>" %>

I get this error:

[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()] Line 184: public class views_register_registrationformcontrol_ascx : System.Web.Mvc.ViewUserControl {

Detailed Error Screen Shot: http://i.imgur.com/Zrtx7.png

Tarik
  • 76,703
  • 82
  • 229
  • 338

1 Answers1

3

The problem is that you cannot have partial classes across multiple assemblies:

Check this answer

Is it possible to have two partial classes in different assemblies represent the same class?

Community
  • 1
  • 1
Jupaol
  • 20,917
  • 6
  • 67
  • 98