System.MissingMethodException Невозможно создать абстрактный класс.- Entity Framework - PullRequest
1 голос
/ 06 января 2012

Это мои сущности:

  Namespace Models.Entity

Public MustInherit Class Client
    <Key()> _
    Public Property ClientID As Integer
    <Required()> _
    Public Property UserName As String
    <Required()> _
    Public Property Password As String

    Public Property OmniSoftKey As String
    <Required()> _
    Public Property isValidated As Boolean
    <Required()> _
    Public Property AddressLine1 As String
    Public Property AddressLine2 As String
    <Required()> _
    Public Property City As String
    <Required()> _
    Public Property TypeOfClient As String
    <Required()> _
    Public Property PostCode As String
    ' <Required()> _
    Public Property ContactPersoon As String
    ' <Required()> _
    Public Property Phone As String
    <Required()> _
    Public Property Email As String
    '<Required()> _
    Public Property BTWNr As String
    Public Property KortingPercentage As Double
    Public Property ConfirmKey As String
    Public Property PrijsCode As Integer

    Public Overridable Property Orders As ICollection(Of Order)


End Class

Public Class SchoolClient
    Inherits Client
    Public Property DefaultClassRoom As String
    Public Property SchoolName As String
End Class
Public Class BusinessClient
    Inherits Client

    Public Property CompanyName As String
End Class

Поскольку мой взгляд не работает, я не буду показывать это.

Мое действие контроллера не запускается, и вот ошибка, которую я получаю:

System.MissingMethodException: Cannot create an abstract class.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Это очень похоже на этот вопрос .

Проблема в том, что это работало раньше. Я не знаю, почему это не сработает сейчас? В чем может быть проблема?

Редактировать:

Контроллер (хотя это событие не запускается)

     Public Function Handle(Optional _Client As Client = Nothing, Optional ByVal OnCheckout As Boolean = False) As ActionResult
        '      Dim x As List(Of Client) = db.Clients.ToList
        ViewBag.CurrentPathDescription = "Inlog / Registreer pagina"
        ViewBag.OnCheckOut = OnCheckout
        Return View("Handle", _Client)
    End Function
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...