code-only

Exclude a field/property from the database with Entity Framework 4 & Code Only

I will like to know that is there a way to exclude some fields from the database? For eg: public class Employee { public int Id { get; set; } public string Name { get; set; } public string FatherName { get; set; } public bool IsMale { get; set; } public bool IsMarried { get; set; } public string AddressAs { get...

Ado.Net Entity Framework Code-Only with Ado.Net Data Service

Im using the pre release of Ado.Net and can't understand how I use that with Ado.Net Data Service. The code for the ObjectContext public class TradingContext : ObjectContext { private static TradingContext _Context; public static TradingContext Current { get { if (_...

Entity Framework v4 - what's the difference between POCO vs Code-Only ?

Hi folks, i'm under the impression that EF with POCO: allows you to map your own POCO's to the entities on the model (.edmx). EF Code-Only: no edmx / model designer (ie. CSDL/SSDL/MSL (collectively EDMX) metadata). Still POCO's but the mappings, relationships, navigation, etc are all manually coded (hence the code-only, description). ...

Entity Splitting with Code Only

Is their a way using Entity Framework Code-Only to have an entity that has fields from two tables if both tables don't contain the primary key? Here is an example. public class BlogPost { public int PostID { get; set; } public String PostBody { get; set; } public int UserID { get; set; } public string Username { get; se...

Using an Interface with a navigation property

I am trying to setup a project using Entity Framework 4, POCO, and Code-Only. Is it possible in entity framework for type of a navigation property to be an interface? I have a "Task" class. A Task can be assigned to a user or a group each of which are represented by a separate class and stored in separate tables. The classes look som...

Do I need anything other than VS2010 beta 2 to use "Code Only" in Entity Framework 4?

Is it possible to use "code only" with Entity Framework in an out-of-the box VS2010 Beta 2, or do I need some additional download? ...

Map a column to be IDENTITY in db with EF4 Code-Only

Although I have marked my ID column with .Identity(), the generated database schema doesn't have IDENTITY set to true, which gives me problems when I'm adding records. If I manually edit the database schema (in SQL Management Studio) to have the Id column marked IDENTITY, everything works as I want it - I just can't make EF do that by it...

How do I verify my EF4 Code-Only mappings?

In NHibernate, there is a method doing something like ThisOrThat.VeryfyMappings() (I don't know the exact definition of it since it was a while ago I last tried NHibernate...) I recall seeing a blog post somewhere where the author showed how to do some similar testing in Entity Framework 4, but now I cant find it. So, how do I test my E...

Where is EntityConfiguration in EF4 VS 2010 RTM?

I cannot find EntityConfiguration. The same question for RC was here but I thought that it would make it to the RTM version. Is it there? ...

Is EF4 "Code Only" ready for production use?

I've been looking at the new Entity Framework 4 Code Only features, and I really like them. But I'm having a hard time finding good resource on the feature. Everything seems to be spread around blongs here and there, so this make me wonder if it's ready to be used for a serious project? What do you think? Is it ready for production use ...

What is the new name of Microsoft.Data.Entity.Ctp?

Hello Everyone I'm playing around with Entity Framework 4 and code only. The tutorial I'm following is using the Beta-Version of Visual Studio 2010 and is referring to Microsoft.Data.Entity.Ctp. Since I'm working with the final release of Visual Studio the name of the dll must have changed. Can somebody tell me how its name is now? Che...

Entity Framework 4 - Code Only - How to set data type property as smalldatetime?

There's a way? var customer = constructor.Entity<Customer>(); customer.Property(c => c.Date).DataType("smalldatetime"); THANKS IN ADVANCE ...

EF4 code only - How do I change column order?

I setup the builder and used CreateDatabase to generate the database. However the table columns created are ordered alphabetically. Is there a way to control the order? ...

"Dealing with uncertainty" - Entity Framework CodeOnly

This is a bit of a strange one but I've just seen something on twitter which kind of baffled me and I'm interested to know more. Rob Conery tweeted the following a couple of hours ago: Class name of the day: "Maybe<T>". Method of the day: "ToMaybe<T>()". He then went on to offer a Tekpub coupon to anyone who could guess where it came f...

Entity Framework Code Only Relationship Not Being Read

(This looks like a long question, but it's not really, honest!) I am trying to get a simple proof of concept working with Entity Framework 4 and the CTP 3 version of Code Only. It feels like I'm missing something really obvious and simple. I have this following test which is failing: [TestFixture] public class ParentChildTests { [...

Entity Framework, Code only & EntityDataSource

Hi, I have an objectcontext and code-only definition of my model. How do i use the EntityDataSource to connect? Is there a way to define a connectionstring to my ObjectContext class? ...

EF4 code only approach for many-to-many relationships

I have the following: Product POCO ProductConfiguration class for EF code only (CTP3) Product table in database ProductCrossSell table in database My Product and ProductConfiguration class looks like: public class Product { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual IColl...

entity framework 4, code-only, relationships

Hi, I can't figure out how to solve the following problem. What i need it a relationship from one base class to another, so that every derived class has a relationship with the same table, called 'Item' in my example. Since this is just an example it doesn't reflect my program. In the real program the relationship with class Item is in...

Entity Framework v4 Code-Only Connection String

I have recently begun to use the EF v4 Code Only library for some projects I am working on. However, I have run into a bit of a snag. I can't seem to figure out the proper format for the connection string. I have used the following code to build the connection string: string connectionString = new EntityConnectionStringBuilder { Pro...

Entity Framework 4 - Code First not storing inherited table separate from base table

With EF Code First CTP 4 I've created a simple project. This project consists of 2 classes, one inherited from other. I wish to store the data in separate tables, but the default of EF 4 is to map/store these two entities in the same table. With .ToTable(), I can change this behavior, but with this I have a side effect: when I persist ...