Issue I’m very newbie with EF and migration. I’m trying to make a rollback with the command, to run the Down method update-database -TargetMigration MyLastMigration Output result Target database is already at version 201701031905415_MyLastMigration. How can I execute the Down
Continue readingTag: entity-framework-6
[SOLVED] EntityType has no key defined error despite defining key
Issue I’m following the tutorial listed here: http://dotnetawesome.blogspot.com/2014/07/nested-webgrid-with-expand-collapse-in-aspnet-mvc4.html using my VS2015 Enterprise IDE. However when at step 8 I go to right click the List() ActionResult in OrderController and select Add View with the following: I get the following error:
Continue reading[SOLVED] Unable to add migration
Issue I have an initial migration which has run successfully, however, when I try to add a new one I’m told I cant because the migration is pending: PM> Update-Database -TargetMigration 201511051706498_InitialCreate -ConfigurationTypeName MyConfiguration -ConnectionString "__My_Connection_String__" cmdlet Update-Database at command
Continue reading[SOLVED] Join two tables in Entity Framework version 6.0 Asp.net mvc with comma separated values
Issue I’m stuck in an issue which I’m unable to solve. I have three tables as below. Number : ID Number User Comments 1 123 Test User 1 This is a test user 1 2 456 Test User 2 This
Continue reading[SOLVED] Create valid generic Entity Framework linq statement
Issue I have a lots of different tables with code levels( 1 to 5, depending of which area the table represents). You can use these to search in different levels of granularity. So i have made a smaller examples of
Continue reading[SOLVED] Entity Framework: Getting exception while inserting row in MySQL Table
Issue I recently switched my database from SQL Server to MySQL. I am still using Entity Framework 6 to do CRUD operation in database. When I was using SQL Server as backend then I was setting "StoreGeneratedPattern" as "Identity" to
Continue reading[SOLVED] How to set starting value for an Identity primary key in Entity Framework code first?
Issue In my project I am creating the Appointments table using Entity Framework code first. When I set my integer primary key, AppointmentNo as [Key] and [Required], it creates the table with initial primary key starting with 1. I want
Continue reading[SOLVED] Weird "assembly not referenced" error when trying to call a valid method overload
Issue I’m using method overloading in Assembly A: public static int GetPersonId(EntityDataContext context, string name) { var id = from … in context… where … select …; return id.First(); } public static int GetPersonId(SqlConnection connection, string name) { using (var
Continue reading[SOLVED] Dynamic table names in Entity Framework linq
Issue I’m using Entity Framework 6 with ASP.Net MVC 5. When using a database context object, is there a way to use a variable for the table name, without having to manually write the query? For example: var tableName =
Continue reading[SOLVED] Getting the result of a computed column from database into an entity
Issue In a project using Entity Framework, say I have an entity such as [Table(“MyTable”)] public partial class MyTable { public string FirstName { get; set; } public string LastName { get; set; } [DatabaseGenerated( DatabaseGeneratedOption.Computed)] public string FullName {
Continue reading