Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum

CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • Entity Framework Code First - BrokenRule has no key defined

    rated by 0 users
    Not Answered This post has 0 verified answers | 0 Replies | 1 Follower

    Not Ranked
    1 Posts
    asprog posted on Tue, Feb 4 2014 4:26 AM


    I'm trying to create my first application with CSLA and Entity Framework using code first.

    But when the client tries to load data for the first time after start I get the following exception on the server:

    A first chance exception of type 'System.Data.Entity.ModelConfiguration.ModelValidationException' occurred in EntityFramework.dll

    Additional information: One or more validation errors were detected during model generation:

    Basilisque.Base.ClientBase.Service.Business.BrokenRule: : EntityType 'BrokenRule' has no key defined. Define the key for this EntityType.

    BrokenRules: EntityType: EntitySet 'BrokenRules' is based on type 'BrokenRule' that has no keys defined.

    While I can read the error and understand that there is no key defined, I don't know how to fix that.

    There is no type 'Basilisque.Base.ClientBase.Service.Business.BrokenRule'. There is no type 'BrokenRule'in my solution at all. So I guess CSLA generates that type at runtime?


    Here is the StackTrace:

       bei System.Data.Entity.Core.Metadata.Edm.EdmModel.Validate()

       bei System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)

       bei System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)

       bei System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)

       bei System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)

       bei System.Data.Entity.Internal.LazyInternalContext.InitializeContext()

       bei System.Data.Entity.Internal.InternalContext.Initialize()

       bei System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)

       bei System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()

       bei System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()

       bei System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()

       bei System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector)

       bei Basilisque.Base.DataAccessBase.Business.BaseDal`4.Fetch() in d:\Develop\ASProg\Basilisque\Main\Source\Base\DataAccessBase\DataAccessBase\Business\BaseDal.cs:Zeile 24.


    Any suggestions?

    Page 1 of 1 (1 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems