entity-framework-6

How to create multiple edmx in same project

独自空忆成欢 提交于 2020-01-06 12:16:00
问题 i am new to EF ... getting this error while adding another edmx in same project using same connection string . this is my connection string <add name="REFLECTIONDBEntities" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string="data source=SERVER;initial catalog=REFLECTIONDB;persist security info=True;user id=sa;password=Sqlsa123;multipleactiveresultsets=True;application name=EntityFramework"" /> 回答1: Same connection Strings Names are not allowed, you

ERROR: EntityFramework.dll not found after I installed Entity Framework 6.1.3

落爺英雄遲暮 提交于 2020-01-06 12:13:10
问题 How can I resolve this error? I have added the Entity Framework 6.1.3 from this link: Download EntityFramework 6.1.3 for Visual Studio 2013 (after uninstalling and re-installing it again and again) Now that it has been added and in the project created a .emdx file using ADO.NET Entity Data Model . When I try to build it, the following error pops: EntityFramework.dll not found (after Compilation) 回答1: Don't uninstall the Visual Studio. Installing the Entity Framework 6 Tools for Visual Studio,

How can I get a list of linked 1-n elements?

不羁岁月 提交于 2020-01-06 07:27:07
问题 That's my basic ( Database First ) diagram on SQL Server : When I Update Model from Database using Entity Framework (6.x) within my MVC application, I expect Users got this property: public virtual ICollection<Role> Roles { get; set; } As well Roles with: public virtual ICollection<User> Users { get; set; } But instead I got: public virtual ICollection<UsersRoles> UsersRoles { get; set; } public virtual ICollection<UsersRoles> UsersRoles { get; set; } Where am I wrong? 回答1: Your design is

How can I query Sqlite in Xamarin using Entity Framework?

巧了我就是萌 提交于 2020-01-06 06:55:10
问题 I'm in a Xamarin.Forms project (C#) using Sqlite and EF plug-in (Microsoft.Enttityframeworkcore.sqlite). What happens depends: Scenario 1: I use "Database.EnsureDeletedAsync" I can put data into DB within the same "using" statement and "dbContext" object, I can retrieve the data using LINQ query no errors. Scenario 2: I do not use "Database.EnsureDeletedAsync" the database already exists I can add data to it within the same "using" statement and "dbContext" object, any attempt to retrieve the

Aggregate table using linq to entities

心不动则不痛 提交于 2020-01-06 06:48:24
问题 I've a table like this Id MachineName ServerName TagName TagValue ValueDateTime 1 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.STR02_METER_DENSITY_(1) 93.1631400000 2018-06-04 21:08:28.720 2 DanPac_A Daniel.Device Links.1 Diagnostics.Heartbeat 1.0000000000 2018-06-04 21:08:32.717 3 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.310-TT-302_(6) 52.1062000000 2018-06-04 21:08:32.873 4 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.310-TT-302_(6) 52.1062000000 2018-06-04 21

Aggregate table using linq to entities

允我心安 提交于 2020-01-06 06:48:18
问题 I've a table like this Id MachineName ServerName TagName TagValue ValueDateTime 1 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.STR02_METER_DENSITY_(1) 93.1631400000 2018-06-04 21:08:28.720 2 DanPac_A Daniel.Device Links.1 Diagnostics.Heartbeat 1.0000000000 2018-06-04 21:08:32.717 3 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.310-TT-302_(6) 52.1062000000 2018-06-04 21:08:32.873 4 DanPac_A Daniel.Device Links.1 Poll.Registers Block 0.310-TT-302_(6) 52.1062000000 2018-06-04 21

Exception when trying to use Mysql.Data.Entity

旧城冷巷雨未停 提交于 2020-01-06 05:23:49
问题 I'm trying to get a test project running using MySQL and EF6 using Visual Studio 2019 Community Preview for Mac. I am using the Web Application (Model-View-Controller) / .NET Core -> App template as a starting point as well as the MyWind database. I'm getting the following exception and am not sure how to proceed. TypeLoadException: Could not load type 'System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider' from assembly 'System.ComponentModel.DataAnnotations,

EF code first migrations, DB generated guid keys

牧云@^-^@ 提交于 2020-01-06 04:26:05
问题 The question as a one liner How do I get EF to generate as part of a code first migration ALTER TABLE [DMS].[Forms] ADD CONSTRAINT [DF_DMS.Forms_Id] DEFAULT (newid()) FOR [Id] GO More detail of the problem I'm to build out a simple table to store information about forms, as it happens I already have this working for another table in my db but if I show you the code (see below) you'll realise the issue i'm hitting is more strange than it might seem ... First the working example entity: [Table(

Unknown column 'Extent1.Discriminator' in 'where clause'

六月ゝ 毕业季﹏ 提交于 2020-01-06 03:35:06
问题 I am using Visual Studio 2013 web form application with MySql database to build a web form application but I have been unable to get passed 'Membership and Role Management'. I used a database first approach for the membership and when I try registering a new user, I get the error message below: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Unknown column 'Extent1.Discriminator' in 'where clause'

╄→尐↘猪︶ㄣ 提交于 2020-01-06 03:35:05
问题 I am using Visual Studio 2013 web form application with MySql database to build a web form application but I have been unable to get passed 'Membership and Role Management'. I used a database first approach for the membership and when I try registering a new user, I get the error message below: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.