Tag: entity-framework

I have SQL Server 2008 R2 SP2 on my desktop with a database named “DB” on it (SQL Server and Windows authentication mode). I created a login/user to access the database without using the windows authentication (I know, it’s bad, we’ll discuss it after). From my laptop, I have no problem accessing the database in […]

In the application I’m developing a user is presented with a number of preferences that they should personalise. The following describes how I think it should be implemented: A preference: public enum Weighting { One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten } public class PreferenceOption { public bool PreferenceOptionSelected { get; set; […]

I am trying to develop a software that takes two databases as its input, compares there tables and show differences between tables. This is what I think and develop. 1) Select all the servers that are installed on machine. 2) Depending on the selected server it list all the databases installed. 3) Depending upon the […]

How can I convert an array of bytes into DateTime? I must do this because I use a property (named CreationDataStamp) with attribute Timestamp for entity framework. A second property (named CreationDate) I use for convert the byte array into DateTime. [System.ComponentModel.DataAnnotations.Timestamp] public byte[] CreationDateStamp { get; set; } [System.ComponentModel.DataAnnotations.Schema.NotMapped] public DateTime CreationDate { get […]

I have a many-to-many mapping/pivot table I had to expose as an Entity in order to model a relationship similar to the following (as per this question Model Entity Framework many-many plus shared relation): Now, I would like to emulate the EF collection Enumerate/Add/Remove functionality that is present on the navigation property of a ‘stock’ […]

I found a related question about entity framework here – Why is Entity Framework passing a parameter as DECIMAL(5,0) for a column defined with NUMERIC(19)? – however the answer explains this as regular behavior of entity framework. In a LinqToEntities query, such as this one: var query = (from x in ctx.bigProduct.AsNoTracking() where x.ListPrice == […]

PROBLEM: I am trying to create a EF6 model using the database first approach. Simply speaking, I have 2 tables tblUser and tblMilkMan which have a foreign key relationship on the UserID column. But when I create a new EDMX diagram and add the 2 tables: I dont see the relationship No navigation properties are […]

I want to update a mediate table’s primary keys. This post suggests to take another primary key and don’t change it, but we’re using our tables in other non-EF projects, I didn’t designed them and I’m not able to change them. Do I have any other option? Anything? Even deleting the old record and inserting […]