ado.net-entity-data-model

Why am I receiving an EntitySqlException when executing a LINQ to Entities query that uses a custom DB Function?

痞子三分冷 提交于 2020-08-10 18:54:26
问题 As you may already know, when using LINQ to Entities with EF6 you can not use Int.TryParse or anything really trying to convert/cast a string to an int. I've created a custom function convention below to mitigate this: Public Class CustomFunctionConvention Implements IConceptualModelConvention(Of EdmModel) Public Sub Apply(item As EdmModel, model As DbModel) Implements IConceptualModelConvention(Of EdmModel).Apply Dim functionParseInt = New EdmFunctionPayload With { .CommandText = String

Setting fetch size in entity framework

流过昼夜 提交于 2020-02-24 11:15:29
问题 I am converting ado.net code to use EF. In my ado.net code i set dataReader.FetchSize = command.RowSize * 1000 and that dramatically improves performance over the default fetch size . When I convert my code to EF, the performance is on par to ado.net code where I didn't specify fetch size, i.e. it's very slow over large records. Any way I could specify fetch size for retrieving records in EF? 回答1: You can set ODP.NET FetchSize in the Registry or the .NET config files when using Entity

Forcing a bridge/join table to become a many to many relationship in EF4

谁说胖子不能爱 提交于 2020-01-16 00:50:12
问题 I have a simple database with 2 main tables with a many to many relationship through a 3rd bridge/join table. This 3rd table has an extra field besides the two keys required, so that Entity Framework transforms it into a full entity rather than a many to many relationship between the other 2 tables. I cannot change this third table in the database itself. Is there a way to ignore the extra field so that EF can do what I want, or a way to manually transform the bridge table into a many to many

Entity Framework Not Generating Classes for Tables or Procedures

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-14 07:56:29
问题 I'm using the Entity Framework to generate the classes and functions in C# I need to interact with the SQL server. For reference, here's one of my tables: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Area]( [ID] [bigint] identity (1, 1) primary key, [Name] [nvarchar](100) NOT NULL ) GO After running the Entity Data Model Wizard (using 'EF Designer from database'), my project has the edmx file and a few new .cs files, but it seems like it's not generating everything it

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,

Pros and cons for using ADO.Net entity model

孤者浪人 提交于 2020-01-03 17:48:29
问题 HI What are the pros and cons for using ADO.NET entity model as a data layer? And should i use LINQ if i'm going to use this technology? Thanks 回答1: First of all: you don't have to use LINQ to use the Entity Framework (EF), but it certainly helps. EF is based upon something the EF team calls Entity SQL , so what really happens when you use LINQ to Entities is that the LINQ expressions are being translated to Entity SQL, which again are translated to whatever SQL dialect your database uses (T

References for DBContext, DBSet<> in Entity Framework

穿精又带淫゛_ 提交于 2020-01-01 03:56:06
问题 I am trying to use ADO.Net Codefirst feature of latest Entity Framework 4.0. As part of that I have installed Entity Framework CTP 4 from Microsft and using Scott's tutorial to create the model first. Inside the tutorial DBContext and DBSet<> is specified. Could some tell what is the reference to be used in order to access this class. I have used the following references however nothing happens for DBContext and DBSet<> System.Data.Entity System.Data.Entity.Design 回答1: Use CTP5 instead it is

Unable to find or load Npgsql with Entity Framework

限于喜欢 提交于 2019-12-31 10:48:54
问题 I am totally lost. In Visual Studio 2015, I created a WCF Library Service project and defined the service and service interface. EntityFramework, EntityFramework.SqlServer, EntityFramework6.Npgsql, and Npgsql was installed with the NuGet console: PM> Install-Package EntityFramework6.Npgsql -Version 3.0.5 Setting the library service as startup then starting debug (f5) correctly read the available procedures. However, upon testing any procedure in the WcfSvcHost, I get the following error: The

C# .Net MVC An object reference is required for the nonstatic field, method, or property

删除回忆录丶 提交于 2019-12-30 10:43:41
问题 I'm a junior in C# and I cant find the solution using search I have a database model (EDM) I have a created a class file in models folder: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; namespace photostorage.Models { public class PhotosRepository { private fotostorageEntities db = new fotostorageEntities(); public IEnumerable<photos> FindUserPhotos(string userid) { return from m in db.photos select m; } public photos

ADO.Net Entity Model - Is there a dialog for selecting the database? [closed]

独自空忆成欢 提交于 2019-12-30 07:08:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am looking for the standard dialog that will allow a user to create a database, connect to an existing database, select the database, test connection, etc.. and create the connection string from that. Is there some standard control for this? 来源: https://stackoverflow.com/questions/3087555/ado-net-entity-model