Tag: entity-framework

Entity Framework: Generated SQL – cannot find data type datetime2

So we migrated dev sql server to 2008. Our UAT sql server is still 2005. i had to regenerate my entity framework model for some other reasons, and upon deploying my work to UAT i noticed this error: cannot find data type datetime2 I profiled the database, and noticed that Entity Framework generated the input […]

Entity Framework 5 wrong data type in query

We are using EF 5.0 as our ORM of choice in our business solution, structured in a n-layer fashion with everything decoupled and a nice composition root with ninject. Lately, we’ve been building a database that uses partitioning underneath, and we have some important indexes on DATE columns. The columns are correctly declared on Sql […]

Should I use a primary key id if table means nothing alone?

This question already has an answer here: Should a database table always have primary keys? 11 answers

Best pattern for storing (product) attributes in SQL Server

We are starting a new project where we need to store product and many product attributes in a database. The technology stack is MS SQL 2008 and Entity Framework 4.0 / LINQ for data access. The products (and Products Table) are pretty straightforward (a SKU, manufacturer, price, etc..). However there are also many attributes to […]

Entity Framework sending parameters as unicode causing performance problems

We have built a EF1 model over a legacy SQL Database. In this database there are columns with non-unicode strings. These columns are also used as keys. We had a problem with performance with one specific query. We noticed that EF was sending the parameter as Unicode. We then rewrote this part of the code […]

Entity framework CREATEs against SQL Server DB nonnullable columns

I am using EFv4 for my ORM and I just tried to insert a record into a table that has multiple columns marked as not nullable and with a default value of empty string (for nvarchar type columns). The problem is that EF does not pick up default values for this column and when I […]

MySql or MS Sql Server with .Net Application

I’m developing a software using .Net platform. I want to know is it better to use MySql instead of MS Sql Server Express or not? My concern is the DBMS integration with ADO.NET and Entity Framework. Of course I don’t want to rewrite the codes which Microsoft has written for integrating MS SQL Server and […]

SQL Server 2008 View with LEFT OUTER JOIN fails on Entity Framework 4

SQL Server 2008R2 Entity Framework 4.x (early version) I recently changed a view within a SQL Server 2088 R2 instance so that it now contains some LEFT OUTER JOINS instead of INNER JOINS which causes some fields to contains NULL now. That leaves with a exception that this fields are not allowed to be null […]

Entity Framework and SQL Server Tuning Advisor

How do I use SQL Server Tuning Advisor to produce recommendations based on Entity Framework queries? Entity Framework uses sp_executesql ‘query’ instead of executing the query and Tuning Advisor does not recognize these queries. I could get the query text manually, but this will only work for very simple scenarious. How do I do it […]

Importing SQL Server's CONTAINS() as a model defined function

I am trying to import SQL Server’s CONTAINS() function in my Entity Framework model so that I can use it in my LINQ queries. I have added this to my EDM: <Function Name=”FullTextSearch” ReturnType=”Edm.Boolean”> <Parameter Name=”Filter” Type=”Edm.String” /> <DefiningExpression> CONTAINS(*, Filter) </DefiningExpression> </Function> Add created my method stub: [EdmFunction(“MyModelNamespace”, “FullTextSearch”)] public static bool FullTextSearch(string filter) […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.