Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*I've narrowed the following error to the QuoteDBContext, which, when added to the modelBuilder, causes the error. Without this class added to the modelBuilder, I get another error that says "EntityType 'Quote' has no key defined. Define the key for this EntityType."*/
- //QuoteDBContext (DBBaseObject just adds some context for columns inherited from elsewhere)
- public class QuoteDBContext : DBBaseObject<Quote>
- {
- private static WebDBContext db = new WebDBContext();
- public QuoteDBContext()
- : base()
- {
- Property(p => p.QuoteDate)
- .HasColumnName("dtQuoteDate")
- .HasColumnType("datetime");
- Property(p => p.QuoteValue)
- .HasColumnName("dQuoteValue")
- .HasColumnType("double");
- Property(p => p.Accepted)
- .HasColumnName("bAccepted")
- .HasColumnType("bit");
- ToTable("Quotes");
- }
- }
- //Quote
- public class Quote : BaseObject (BaseObject adds auditing columns)
- {
- public virtual Client Client { get; set; }
- public DateTime QuoteDate { get; set; }
- public double QuoteValue { get; set; }
- public bool Accepted { get; set; }
- public Quote()
- {
- QuoteValue = 0;
- Accepted = false;
- }
- }
- /*The stacktrace:
- System.InvalidOperationException was unhandled by user code
- HResult=-2146233079
- Message=Sequence contains no matching element
- Source=System.Core
- StackTrace:
- at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
- at System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest, String name)
- at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(EdmProperty column, EntityType table, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration)
- at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.<>c__DisplayClass1.<Configure>b__0(Tuple`2 pm)
- at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
- at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(IEnumerable`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration)
- at System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride)
- at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride)
- at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
- at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
- at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
- at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
- at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
- at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
- at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
- at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
- at System.Data.Entity.Internal.LazyInternalContext.MarkDatabaseInitialized()
- at System.Data.Entity.Database.Initialize(Boolean force)
- at Jobber.Web.MvcApplication.Application_Start() in e:\Development\Jobber\Jobber.Web\Global.asax.cs:line 28
- InnerException:*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement