مرجع تخصصی برنامه نویسان

انجمن تخصصی برنامه نویسان فارسی زبان

کاربر سایت

source

عضویت از 1395/11/13

ارور Sequence contains no matching element

  • پنجشنبه 19 مرداد 1396
  • 20:52
تشکر میکنم

سلام

با این ارور موقع update-database مواجه میشم.

Sequence contains no matching element

پاسخ های این پرسش

تعداد پاسخ ها : 8 پاسخ
کاربر سایت

سهیل علیزاده

عضویت از 1396/04/09

  • پنجشنبه 19 مرداد 1396
  • 20:54

در متد Seed از ()First استفاده کرده اید؟

کاربر سایت

source

عضویت از 1395/11/13

  • پنجشنبه 19 مرداد 1396
  • 21:09

خیر

تازه لایه های مورد نیازم رو ایجاد کردم

الان که میخوام آپدیت کنم که تیبل رو واسم بسازه ..... خبری نیست و با این ارور مواجه میشم

کاربر سایت

source

عضویت از 1395/11/13

  • پنجشنبه 19 مرداد 1396
  • 21:10

این رو در ابتدا میده 

Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.InvalidOperationException: Sequence contains no matching element
   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.ConfigureColumn(EdmProperty column, EntityType table, DbProviderManifest providerManifest)
   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__DisplayClass4.<Configure>b__3(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, ICollection`1 entitySets, 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.get_ModelBeingInitialized()
   at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
   at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
   at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
   at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
   at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

کاربر سایت

سهیل علیزاده

عضویت از 1396/04/09

  • پنجشنبه 19 مرداد 1396
  • 21:26

این ارور مربوط به دو متد Single , First می باشد.

در تعریف DataAnotation ها یا قسمت دیگری چیزی را به اشتباه وارد کرده اید.

کاربر سایت

source

عضویت از 1395/11/13

  • جمعه 20 مرداد 1396
  • 00:22

این علامت روی Configration چیه؟ توسی رنگه که مثل قلب میمونه؟

و اینکه تووی قسمت seed چیزی معرفی نکردم و تعریف.

کاربر سایت

source

عضویت از 1395/11/13

  • جمعه 20 مرداد 1396
  • 00:23

این هم DBcontext هست

namespace www.bicand.com.DBContext
{
    public class MasterDT : DbContext
    {
        // Your context has been configured to use a 'MasterDT' connection string from your application's 
        // configuration file (App.config or Web.config). By default, this connection string targets the 
        // 'www.bicand.com.DBContext.MasterDT' database on your LocalDb instance. 
        // 
        // If you wish to target a different database and/or database provider, modify the 'MasterDT' 
        // connection string in the application configuration file.
        public MasterDT()
            : base("name=MasterDT")
        {
        }


        DbSet<Menu> Menu { get; set; }


        // Add a DbSet for each entity type that you want to include in your model. For more information 
        // on configuring and using a Code First model, see http://go.microsoft.com/fwlink/?LinkId=390109.

        // public virtual DbSet<MyEntity> MyEntities { get; set; }
    }

    //public class MyEntity
    //{
    //    public int Id { get; set; }
    //    public string Name { get; set; }
    //}
}

کاربر سایت

سهیل علیزاده

عضویت از 1396/04/09

  • جمعه 20 مرداد 1396
  • 00:48

1)بانکتون رو حذف کنید.

2) Migration ها ایجاد را پاک کنید 

3) دوباره Add Migration را اجرا کنید.

کاربر سایت

source

عضویت از 1395/11/13

  • دوشنبه 23 مرداد 1396
  • 02:05

مرسی smiley

کاربرانی که از این پست تشکر کرده اند

هیچ کاربری تا کنون از این پست تشکر نکرده است

اگر نیاز به یک مشاور در زمینه طراحی سایت ، برنامه نویسی و بازاریابی الکترونیکی دارید

با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)