entity-framework-6

Firebird DDEX 3.0.1 with VS2013 System.Data.Entity.Core.MappingException

谁都会走 提交于 2019-12-13 01:54:13
问题 I am using VS2013 + EF 6 + .NET 4.5, installed FirebirdSql.Data.FirebirdClient via nuget like; install-package FirebirdSql.Data.FirebirdClient-EF6 After, I installed DDEX 3.0.1, try to add new Entity Data Model (DB First), define new connection with successful "Test Connection". And then, when it tries to retrieve database objects, it gives me below exception; How can I fix this issue? TIA. 回答1: This is a known issue when using EDMX (Code First is not affected). 来源: https://stackoverflow.com

Table aggregation using linq (calculate Average value)

落爺英雄遲暮 提交于 2019-12-13 01:43:33
问题 How to Aggregate below table using linq query Date tagname value 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(4) 54.73497 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(5) 3.417564 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(4) 94.82829 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(4) 15.08091 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(5) 3.6422 06-06-2018 14:15:00 Poll.Registers Block 0.310-PT-304_(4) 5.078211 06-06-2018 14:15:00 Poll

EF sorting & paging - slow as ordered twice?

妖精的绣舞 提交于 2019-12-13 00:43:23
问题 I have a simple entity, and I have 100,000 of them in my SQL Sever 2012 database: public class Entity { public int Id { get; set; } public string Field1 { get; set; } public string Field2 { get; set; } } I want to show these in a grid, paged as 100,000 is far too many to show on one screen (and not very efficient). The grid should allow sorting and filtering - obviously all 3 of these operations are best done on the server, and EF should translate these. So, lets get the second page of 500

Entity Framework relation not loaded from database

余生长醉 提交于 2019-12-12 23:04:58
问题 I'm playing around with Entity Framework 6 Code First and have the problem that a many-to-many relationship is not correctly synchronized to my "internal" objects. I got following classes: public class ClassA { public String AId { get; set; } public ICollection<ClassB> Bs { get; set; } public ICollection<ClassC> Cs { get; set; } } public class ClassB { public int BId { get; set; } ICollection<ClassA> As { get; set; } } public class ClassC { public int CId { get; set; } public ClassA A { get;

EF Code First with existing database on another database

一曲冷凌霜 提交于 2019-12-12 22:51:31
问题 The title is a bit confusing but I'm trying to specify that the problem is not initiating a code first model and migration for an existing database, but comes after that. I needed to activate automatic migration because we switched to a code first model for our system. So, here's what has been done: I created an empty InitialCreate for the existing database I did some other scripts because there were some changes, those worked OK and the scripts were created and run on database The problem

Entity Framework 6 Code First approach - unique constraint doesn't work

99封情书 提交于 2019-12-12 21:58:36
问题 I am using EF 6 with code first approach. In addition to database constraints check at database level, I would like to provide unique constraints check at POCO level. I have followed article Setting unique Constraint with fluent API? where someone suggested to use [Index()] attribute. I have applied the same in my poco class but looks like it is still throwing an exception from Database level. Here is my code: [Key] public decimal OrderId { get; set; } [Index("ORDER_CC", 2, IsUnique = true)]

Complex Object won't return when using 'include' syntax in WCF with Entity Version 6

守給你的承諾、 提交于 2019-12-12 20:17:46
问题 Okay so this one has got me stumped as I just see that my client basically disconnects and terminates when returning an object with 'include'. However it works fine without that across a WCF SERVICE. The problem is that I really want those connected objects set up through navigation. Basically the code is a complex object return: public teCIF getCif(int aCifId) { using (CIFContainer context = GetCifContext()) { var thing = context.teCIFs .Include("Product_TYPE") .FirstOrDefault(i => i.CIF_ID

Which approach is better to define Data Annotation (View Model or Entity )? [closed]

陌路散爱 提交于 2019-12-12 20:05:34
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Better approach to define Data annotation in entity or view model ? I have entity and view model for the same entity and override the class with Data Annotation of entity framework. The question is i can add them without creating a separate model however i have concern about

How can data be streamed from a LINQ to Entities query?

早过忘川 提交于 2019-12-12 19:24:27
问题 I'm wondering how one would go about streaming data from SQL server using EF6. Assume having these classes PersonRepository EFPerson (EF model) DomainPerson (Domain model) PersonUsingClass Assume that PersonUsingClass depends on getting a bunch of DomainPersons. Assume that business rules dictate that EFPersons aren't allowed to leave the PersonRepository. Normally I'd have a repository method looking like this: public IEnumerable<DomainPerson> GetPeople() { using (var db = new efContext()) {

Entity Framework 6 Code First int Identity column value is zero for first row

ε祈祈猫儿з 提交于 2019-12-12 19:17:33
问题 After the first execution of the update-database command to populate the database with seed data: Found that all int Id columns started with zero (0) rather than the expected one (1). Added the following 2 lines of code for each entity/table to the top of the Seed method in Configuration.cs: [Note: Because of the foreign key constraints, I deleted all rows in descendent tables, and then worked my way up the ancestral chain.] context.Database.ExecuteSqlCommand("delete from Widgets"); context