entity framework - Enable Migrations Not working -
I have an application that has three layers. I am using EntityFramework 6.1 and the first migration code using the existing database. The three layers are
1. attendance level : ConceptuCodeFirstMigrationDemo just a console application for simplicity
data layer terms and Starter The codes are given below:
Namespace ConceptuCodeFirstMigrationDemo.Data.DataContext {Using the system; Using System.Data.Entity; Using System.ComponentModel.DataAnnotations.Schema; Using System.Linq; ConceptuCodeFirstMigrationDemo.Domain; Public partial class concept indicator: DBCTNET, IDisposable {public concept context (): base ("name = concept capture") {} public virtual dbset & lt; Users & gt; User {Received; Set; } Secure Override Zero OnModelCreating (DbModelBuilder ModelBuilder) {modelBuilder.Entity & lt; Users & gt; (). Essentially (E => E. User) .HasForeignKey (E = & gt; E. Creet). WillCascadeOnDelete (wrong); }}}
ConceptuInitializer.Cs
namespace ConceptuCodeFirstMigrationDemo.Data.DataContext {public class ConceptuInitializer: System.Data.Entity.CreateDatabaseIfNotExists & lt; ConceptuContext & gt; {}}
Appconfig:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Configuration & gt; & Lt; ConfigSections & gt; & Lt ;! - For more information about entity framework configurations, go to http://go.microsoft.com/fwlink/?LinkID=237468 - & gt; Visit & Lt; Section name = "Antinafremvrk" type = "Sistmkdeta.antitikinanl. Confiffail. Antitifremvrkvivrn, Antitifremvrk, Version = 6.0.0.0, Culture = neutral, Pblikkey token = B 77 A 5 C 561 934 A 0 0 9 0" Avshyktapradrshn = "False" /> & Lt; / ConfigSections & gt; & Lt; EntityFramework & gt; & Lt; References & gt; & Lt; Context type = "ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuContext, ConceptuCodeFirstMigrationDemo.Data" & gt; & Lt; Database initial type = "ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuInitializer, ConceptuCodeFirstMigrationDemo.Data" / & gt; & Lt; / References & gt; & Lt; / References & gt; & Lt; DefaultConnectionFactory type = "System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> & Lt; Providers & gt; & Lt; Provider invarianatName = "System.Data.SqlClient" type = "System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> & Lt; / Providers & gt; & Lt; / EntityFramework & gt; & Lt; ConnectionStrings & gt; & Lt; Name = "ConceptuContext" connectionstring = "Data Source = Amitabh-PC, the initial list = Conceptu; User ID = sa; password = lovediya; MultipleActiveResultSets = true; application add = EntityFramework" ProviderName = "System.Data.SqlClient" / & gt ; & Lt; / ConnectionStrings & gt; & Lt; / Configuration & gt;
Domain layer: User category includes an entity category for example
When I enable the migration using enabled-migration After trying to write a new class, the assembly is not showing any reference type in 'ConceptuCodeFirstMigrationDemo'.
I tried the following command: Enabled-migration - ContextTipName Concecutus CodeFirst MigrationDemon.Data. Datacontext. Conseptu Conteks
The following error displays was not found in the terms of 'ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuContext' assembly 'ConceptuCodeFirstMigrationDemo'.
After I tried the following command -Migrations ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuContext
shows the following error
able-migration accepts can not be found a positional parameter that is logic 'ConceptuCodeFirstMigrationDemo.Data.DataContext' Usiontekst in concept to 'line: 1 char: 18+-enabled migration & lt; & Lt; & Lt; & Lt; ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuContext + CategoryInfo: InvalidArgument: (:) [able-migration], ParameterBindingException + FullyQualifiedErrorId: PositionalParameterNotFound, able-migration
try this.
Enable-migration -ContextTypeName ConceptuCodeFirstMigrationDemo.Data.DataContext.ConceptuContext -ProjectName ConceptuCodeFirstMigrationDemo
Comments
Post a Comment