entity-framework

Is there a Visio template for Entity Framework data models?

Is there a template in Visio for creating Entity Framework data models? I am specifically lookig for shapes that contain the Entity name, and sections for 'Scalar Properties' and 'Navigation Properties'. Please forgive me if my terminology is incorrect, I am relatively new to Entity Framework. Alternatively, is there another program t...

ObservableCollection

Ive posted another thread regarding refreshing a silverlight listbox - In the meantime Ive become slightly more familiar with the issue. It has to do with implementing the ObservableCollection interface. Im using RIA services to populate a listbox with a collection of type ObservableCollection. The problem is refreshing the Items once ...

Entity framework - Create entity to multiple related tables

We have three tables. TableA relates to TableB and TableB relates to TableC. Is it possible to create a new entity framework entity composed of all three tables without using a stored procedure or view? It only seems to allow one level of mapping where we have two in this case. Any help or tutorial appreciated. ...

Controls not updating on inserting an Entities object

Hello I have an Entity "Candidate" which is set as a datasource for a GridView and a combobox. When i Update or Delete something, thw datasource is updated and the gridview and combobox show the changes. However when i inser a new Entity then the data in the two controls doesnt refresh automatically. i have to close and reopen the form ...

Function Import and Repository pattern with Entity Framework 4.0

Could anyone advise me on how they've implemented the use of Function Imports when using the Repository pattern against EF 4.0? We have a table mapped to a Candidate Entity and also a Function Import off an existing sproc that maps to Candidate. This works great in EF but we're abstracting by use of Repositories which take on their con...

Entity Framework 4.0 & null fields in Views

We're adding some views to our entity framework model. Some fields in these views are nullable datetime2 datatypes in our sql server 2k8 db and the edmx is incorrectly showing these fields as being not null. Is this a known issue? When I try to change them to not null it still throws the same error - because it appears as if the ssdl is...

Entity Framework 4.0 Creating a new entity derived from other entities

I currently have a complex entity relationship setup based on my data structure in sql server 2008. What I'm trying to do I would think would be ridiculously simple but I'm pulling my hair out and have spent days trying to figure it out. I have an Address and AddressType table which are joined on addressTypeID. There are 2 AddressType...

Entity Framework - Entity Mapping problem

I have two tables: Address and Contact which are joined on contactID (in Contact). Both of these tables have entities in my Entity data model (EF 4.0) and I do not wan't to modify them. I do want to create a new entity that contains information from both entities. What I did so far: In CSDL: <EntityContainer...> <EntitySet Name="...

EF4 "Code Only" - How to set default value for POCO's

In Entity Framework 4, Code Only (CTP3), how do you set a default value for a property in the POCO's EntityConfiguration class? public class Person { public int Id { get; set; } public string Name { get; set; } public DateTime CreatedOn { get; set; } } public class PersonConfiguration : EntityConfiguration<Person> { public PersonCo...

Adding new Scalar types to EF 4

Entity framework maps DB types to .NET types, for instance SQL Server's BigInt is mapped to .NET's long. Is it possible to create a new type and have a store type (such as BigInt or VarChar) mapped to it? If so, how? FYI, my goal is to change the way the .NET scalar writes its value to the query, and specifically the way its default v...

Extend model class in ASP.MVC (inheritance?)

Hello, i'd like to create something like wrapper or mayby better word would be "Extension" for generated in EntityFramework model class... I've got model USER, with password, username etc... and user is in relation many-to-many with some other objects... whatever... I'd like to create something like this: class ExtendedUser : USER { ...

Deploying desktop WPF/SQLite application

I'm trying to deploy a desktop application written on WPF 4.0 that uses SQLite through Entity Framework. So i've changed .config file (absolute path to db -> relative) and copied database file itself to app's directory. It seems to be working fine, but on other PC it's throwing an error during runtime. Supplying System.Data.SQLite.dll an...

entity framework: how to assign foreign key in a entity..

Hi all, Here is my tables structure.. Profile: ProfileID (PK), ProfileName varchar(50), GenderID (Fk) Gender: GenderID (PK), GenderName varchar(50) Gender table has 2 possible values : Male, Female. In entity framework, when I am updating the profile with GenderID, I use the following code: profile.GenderID = Repository. ...

EF, TPT and foreign key problem

Hello I have a problem with TPT inheritance + foreign key. I'm working on a web application with multi language support, including translating dynamic content. Here's my tables: Language Id, Name ProcessingAgent Id, some other fields LocalizedProcessingAgent LocalizedProcessingAgentId, Name, Description, LanguageId As you alread...

Entity Framework 4 - Update database schema from model. Without wiping the table data.

Hello, I'm working on a new project where I have the luxury of working from a Model to Database approach using Entity Framework 4. The project I'm working on is taking an agile approach where different phases will be rolled out over time. Will the Model First approach work in my case? I noticed when you "Generate Database from Model"...

Is this a proper way to use POCOs?

Function DeepLoadDoctors(ByVal doc As Doctor) As Doctor Implements IDoctorsService.DeepLoadDoctors Using _context As New referee2Entities doc = _context.Doctors. Include("DoctorLicense"). Include("DoctorHome"). Include("DoctorHome.ContactInfoes"). ...

Entity Framework 4 -- possible to call a SSDL function from within another SSDL function's commandtext?

Is it possible to call a SSDL function from within another SSDL function's CommandText? For example, let's say I have the following SSDL function defined in my edmx file: <Function Name="blah" IsComposable="false"> <CommandText> ...blah related stuff... </CommandText> <Parameter Name="blah_param" Type="int" /> </Function> C...

How do I execute LINQ queries against a database with varying schema?

I need to execute read-only queries against a database that I don't control. My top choice would be Linq to SQL, however, the column names differ slightly between our Dev, QA, and Production environments. For example, take a FolderName column. We might have: Dev: u34_FolderName QA: u74_FolderName PROD: u56_FolderName I want to d...

Many-To-Many Relationship in Code-First EF4

How do you represent a many-to-many relationship in the EF4 Code-First CTP3? For example if I have the following classes: class User { public int Id { get; set; } public string Name { get; set; } public ICollection<Profile> Profiles { get; set; } } class Profile { public int Id { get; set; } public string Name { ge...

Async=true and Entity Framework

Background WCF Stack, Data Access Implemented in Entity Framework, Simple ASP.NET Front End This is a two part question. Recently we ran into an issue with periodic crashes with an exception that read: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified ne...