Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [entity-framework]

For questions relating to Microsoft's object-relational mapper.

0
votes
0answers
15 views

Entity Framework / SQL - Excluding multiple columns data [migrated]

I am trying to exclude some data from one of my entity framework queries but I can't seem to get it right. RequestInformation.Where(x => x.RequestSubmitTime >= DateTime.Today.AddMonths(-1) &...
3
votes
2answers
120 views

SQL Server one-to-many and index fragmentation

I'm currently writing code to update an entities child collection (one-to-many relationship), and while thinking about how to write code to determine which entities have been added/removed/modified, I ...
3
votes
0answers
43 views

Does SQL Server allow user to create in-memory database for testing? [closed]

Does SQL Server T-SQL allow in-memory database testing? So if we have multiple qa testers running the same test, every one gets an in-memory database, and results will not collide? I know C# Entity ...
2
votes
2answers
77 views

Performance problem with big query on first run

I'm having a problem with a query usually being so slow on first time run that it times out and then executing in under a second once it's loaded into cache. The query looks something like this exec ...
1
vote
1answer
179 views

Can Entity Framework access In Memory OLTP Tables?

Are there any restrictions with having Entity Framework access In Memory OLTP Tables? Or is this not possible?
3
votes
1answer
48 views

Delete Joined to Derived Table Causes Index Scan and Table Spool

Our application uses a popular 3rd-party extension to Entity Framework that allows for valuable things that native Entity Framework is not capable of or designed to do, like bulk deletes and updates. ...
0
votes
0answers
95 views

EF Query as RPC - is it parameter sniffing?

Somewhat similar to this -- Why does sp_executesql use a different query plan? -- i.e. a C# app, using EF to SQL, but with a much simpler query. Here's the sample, as captured by Profiler and XEvents:...
0
votes
0answers
60 views

Modifying a T-SQL Stored Procedure with Cursor for use with Entity Framework

I am having some difficulties trying to use a stored procedure which contains a cursor with an ADO.NET Entity Data Model. Below is the stored procedure I am working with: USE [NDTMS2Data] GO /****** ...
0
votes
0answers
427 views

How to do an equivalent of SQL merge in Entity Framework?

Let's say that I have some table with a synthetic PK (column ID) and a real two-column unique index (made out of IdxParam1 and IdxParam2): CREATE TABLE [dbo].[SomeTbl] ( [ID] [bigint] IDENTITY(1,...
3
votes
1answer
1k views

Passing an array of integers as a parameter of an (inline) user defined function (SQL Server)

I have TBV function . Like this ALTER FUNCTION [dbo].[fn_Functiont] ( @accessibleIds ListAccesableIds READONLY ) RETURNS TABLE AS RETURN ( SELECT d.*, b.Name AS Name, ps.Name AS ...
1
vote
0answers
201 views

Keeping MySql connections alive

I'm running a Windows service, which connects to a MySql database via Entity Framework. Every 10 seconds it issues a query to the database to see if any new records have been added. If it finds any, ...
5
votes
1answer
119 views

Empty result takes longer with all columns included

I'm executing a query every 1 second and most of the time it returns no results (SQL generated by Entity Framework): SELECT TOP (5) [Extent1].[ID] AS [ID], ***30 more columns*** FROM ...
0
votes
0answers
87 views

SQL Server bitfield/flags in int indexing

In a schema, an int is used as a bitfield, one of those bits is used in a frequently called SQL query (a bit marking entries to be new for processing). The query (entity framework generated, got it ...
1
vote
1answer
158 views

Inserts via Entity Framework on server take about double the time than locally

I'm inserting lots of data into SQL Server with many of them having foreign key dependencies. Meaning if I insert 1 row in my Person table, I'm also inserting 1 row in 8 other related tables. This ...
1
vote
2answers
1k views

SQL Server Order SELECT List with condition

I want order the select list with condition. For example; I have t1 table and it has 3 columns and 6 rows Table t1: +----+---+---+ | id | x | y | +----+---+---+ | 1 | a | 1 | | 2 | b | 3 | | 3 |...
0
votes
1answer
129 views

My first database schema design

I'm new to programming and databases and working on my first application using .Net, Entity (for SQL Server) and Identity. My application will allow users to create html pages for online courses. ...
0
votes
1answer
254 views

sp_executesql processes uniqueidentifier-param with EntityCommandExecutionException but still acts like expected

I use a Azure DB(MS-Sql) and administrate the DB with Management Studio for SQL Server 2016. My Application is a simple C#/WPF-Application. So here we go, this is my SProc: ALTER PROCEDURE [dbo]....
0
votes
0answers
87 views

How to group by week and update a Foreign Key value

Building are inspected daily and saved in Daily Inspections table, then they're to be grouped weekly and mapped to 1 record per week in Weekly Buildings table I created test data for building daily ...
0
votes
0answers
172 views

Benefit of creating composite keys on multi tenant data

I'm a developer who more and more dive into being a DBA for the system I'm working on. The system is multi tenant but without any wider use of tenant_id on each table. I was part of that decision back ...
3
votes
1answer
110 views

Entity Framework Coupling with Database

I am new to EF and Database Design. I have been studying about using Repository Pattern and Unit of Work a lot, and I have seen a lot of queries made with LINQ. But I have one question. If, in ...
2
votes
3answers
1k views

Visual Studio database project and Enity Framework code-first

At work we are developing our latest module in C# Entity framework code-first approach. I have been given the role of developing databases from the DBContexts from within the project/s. I generated ...
1
vote
1answer
334 views

Parent / Child relation appears to insert out of order via EntityFramework

I'm facing a peculiar issue, when the following code completes, and using (var db = new DbContext()) { var msReceived = new MilestonesReceived() { ...
3
votes
1answer
103 views

DB Design Challenge

I don't have much experience designing databases and I have this case that I stumbled upon where I hope there is a definite answer in terms of DB design methodologies. I also have to mention that I am ...
-1
votes
2answers
144 views

Custom Paging in Stored Procedure (Optimizing the Performance)

I have a stored procedure that is working perfectly but the issue is performance. There are so many joins in this stored procedure and unions... So after having the query executed, i need to send only ...
1
vote
1answer
268 views

Unnecessary Hash Match in Query

I've just migrated a database from SQLExpress (Entity, Database First) to Azure (Entity, Code First) and some of the indexes are missing because they werent migrated (on purpose, I think a lot of them ...
-1
votes
1answer
164 views

Inheritance and performance in database [closed]

I have 3 table linked by an "inheritance" with Entity Framework. Sadly, I have poor performance with those query because I can't make any good index. Here is the tables : CREATE TABLE [dbo].[...
0
votes
1answer
616 views

Create a User and Password for ADO.net and SQL SERVER Authentication

I am trying to create a sample application in asp .net mvc with sql server authentication. I want to create a user with password in sql server so that i can provide it in connection string in asp ....
5
votes
2answers
976 views

What's the best practice of inserting a collection of data into a SQL Server database

I am using C#, Entity Framework. SQL Server for the development. I have a method which has two parameters (int ID, List<String> _listobj). For each ID, there is a list of obj. All of these IDs ...
4
votes
1answer
270 views

Data read from linked server returns different data-type on production server

I have a SQL Server grabbing data from a linked Oracle server inside a SP. On my development server, EF6 insists the SP is returning a double datatype for one of the columns, but in prod, it insists ...
0
votes
1answer
99 views

The same set of columns for two tables

I have the following db schemas: Comments table and Posts table ( has FK to Comments table) : As you can see, there is a set of the same columns for both tables. Is it bad design? If yes, how can ...
3
votes
1answer
66 views

Complex dto based result sets with EF and MS SQL server

ok lets say I have a collection of these ... public class ReferenceLookup { public string InvoiceNumber { get; set; } public CompanyReference Buyer { get; set; } public CompanyReference ...
3
votes
1answer
2k views

Entity Framework SaveChanges fails due to a trigger

Trying to implement Entity Framework for an existing database (SQL Server 2012). I have a VB application running and trying to convert it to the EF based Web API. When I insert data into the table ...
2
votes
1answer
157 views

best way to add Entity id & entity types in database

we are doing shopping site with mysql with eav model to store values. in below image , 2 types of entity types are there under products_information table : 1) Mobile 2) T-shirts I wanted to know in ...
2
votes
1answer
1k views

Handle concurrency on sql server for a booking system

I've been banging my head against the wall trying to solve this problem and I couldn't come up with a solution that absolutely guarantees two users can't book an appointment for the same time. The ...
0
votes
2answers
2k views

Why shouldn't I increase SQL Server's timeout globally everywhere?

I have an application in which some reports time out before getting data. We started increasing timeout througout our code in different places, and as our database is growing bigger and bigger, we see ...
0
votes
1answer
25 views

Remove some auto created indices from Entity Framework?

I'm using Microsoft's Entity Framework. It automatically creates indices for every foreign key, but in many cases, I can see from the index stats that these are never used for reading - they are only ...
0
votes
0answers
120 views

one Comment table for all content types or many tables for each content type

I have a very similar question with this stack overflow link but since its not answered I had to post it again. I have many place which people can place comment: file download, biography, blog and etc....
1
vote
1answer
1k views

Very slow insert performance on large table (EF) [closed]

One of our systems has a table that receives around 20k inserts per day - it currently contains ~10m rows. We've just pushed out a system upgrade and I'm intermittently getting some shockingly slow ...
0
votes
0answers
239 views

Help with SSIS Framework- Resolve Referrences in Data Flow

LineageString and StageKey are both unmapped. SSIS is giving me an error between the OLE DB Source and the Add metadata. Add Metadata.Inputs[Derived Column Input].Columns[LineageString] has lineage ...
3
votes
2answers
420 views

Table with only a single constant value?

I use C# entity framework code first. My knowledge regarding databases is almost nothing. I don't know if it's common or good practice so I wanted to ask you guys how I should do it. Say I have a ...
0
votes
0answers
285 views

PK Guid, Clustered Indexes and Fragmentation

I need your help solving a db headache. I'm using Entity Framework as a ORM to access my database (SQL Server Azure V12), the entity model uses Guid as PK and by default SQL Server has clustered ...
6
votes
2answers
501 views

SQL server Database statistics degrading after execution

I have been experiencing timeouts while querying my SQL Server DB in particular one table. I tried updating the statistics and it fixed the performance issues for a couple of days. I started digging ...
3
votes
0answers
145 views

Azure SQL DB migration from Visual Studio raises collation error

I want to run a migration in my Azure hosted database. The migration works perfect in several local machines. When I try targeting the Azure database it raises the following exception: Column X is ...
1
vote
0answers
114 views

Splitting very large working table

I read the good posts here and here, but my scenario is a bit different, I cannot consider that older data becomes read-only data because any record in my Transactions table can be subject to updates ...
-4
votes
1answer
4k views

Entity Framework C#: Get rows between two dates [closed]

I have an SQL server database with a column named "Time" of format "datetime". In C# Entity Framework, I want to get all rows whose date is after 8am of today: using (var db = new ...
1
vote
1answer
72 views

How to return the difference (columns) between two databases or tables

I have a database that has been updated, many columns have been added. Currently the only way of returning the differences between the two databases is by going through the database.cs class that is ...
0
votes
1answer
32 views

Foreign key not able to get one to many working

I want to have a one to many relation with player points but I need it in such a way that entity framework sees it as a collection so i can add to it. I mean that one player can have multiple points ...
0
votes
1answer
17 views

Entity or attribute if only one field beside key and attribute for other entity?

Let's say I have an entity person which has an attribute Email. But the person can have more than one Email address. So I have to put this attribute into a separate table. But what I do not ...
3
votes
1answer
2k views

Encryption/Decryption with stored procedure / view

I'm working on a project that uses Entity Framework for programmers to access the data. We've recently found need to add fields that were determined that need to be encrypted. This will be the first ...
2
votes
2answers
107 views

One table or duplicate table with same properties but different dependencies

Disclaimer: I'm new to database modeling so I apologize in advance if the question is unclear or causes any confusion. I am using .NET Entity Framework and have the following tables: An Order can ...