Questions tagged [ctp4]
21 questions
56
votes
10 answers
Entity Framework CTP 4. "Cannot insert the value NULL into column" - Even though there is no NULL value
Im using EF CTP 4. I have a simple console app (for testing purposes) that is using EF to insert some data into a SQL database.
I have come to a problem where by upon inserting the item
using(var context = GetContext())
{
BOB b = new BOB();
…

Squirrel5853
- 2,376
- 1
- 18
- 34
27
votes
6 answers
Entity Framework CTP 4 - Code First Custom Database Initializer
I would like to implement a custom database initialization strategy so that I can generate the database schema and apply it to an EXISTING EMPTY SQL database using a supplied User ID and Password.
Unfortunately the built-in strategies don’t provide…

Mark
- 6,051
- 2
- 26
- 25
12
votes
4 answers
Entity Framework Code First CTP4 Default Column Values?
I have been looking into Code First with Entity Framework CTP4 and you can use the ModelBuilder to build up your table columns. Is there a way to set the default value for a column in the database using the ModelBuilder or some other…

Lukasz
- 8,710
- 12
- 44
- 72
6
votes
2 answers
How can I restore Visual Studio 2013 Update 5 to Visual studio 2013 update 4 without uninstalling entire product
I have to use Web Essentials 2013 but it is not available for Visual studio 2013 update 5.I would have to have VS 2013 update 4 installed in order to install Web Essentials 2013. Is there is any way I can install VS 2013 update 4 without…

Husrat Mehmood
- 2,270
- 1
- 20
- 22
4
votes
0 answers
Entity Framework persisting child collection sort order
In NHibernate I can map a collection as a List to persist the order of the collection to the database.
I'm using EF Code First (CTP4). How can I persist the sort order of a child collection (IList) without exposing the relationship in my domain…

Ben Foster
- 34,340
- 40
- 176
- 285
4
votes
2 answers
EF CTP4 cascade delete on many to many relationship
I've created a many to many relationship using default conventions in EF CTP4 by defining an ICollection on both image and project entities.
The mapping table is created as below:
create table [dbo].[Images_Project] (
[Images_Id] [uniqueidentifier]…

Ben Foster
- 34,340
- 40
- 176
- 285
3
votes
1 answer
Foreign key as TPH discriminator in EF4 using CTP4 Code First
To summarize my model:
License and Certificate are children of Qualification
A Qualification has one and only one Profession
A Profession is either a licensed kind (type 1) or a certified kind (type 2)
Requirement: Represent the relationships…

Antony
- 1,451
- 1
- 12
- 25
3
votes
2 answers
Code First CTP4: Table with no primary key?
With Entity Framework and Code First, is it possible to let it create and use a table with no primary keys? I can't get this setup to work:
public class Report
{
public virtual int ReportId
public virtual ICollection…

Buginator
- 846
- 11
- 18
2
votes
1 answer
EF CTP4 : "The context cannot be used while the model is being created."
I have two entities : Student and Class.
they have a many-to-many relationship between each other :
class Student
{
ICollection Classes{get;set;}
}
class Class
{
ICollection Students{get;set;}
}
when I try to execute the…

Attilah
- 17,632
- 38
- 139
- 202
2
votes
1 answer
CTP 4 doesn't consider base class properties
In Below sample, CTP consider only User class properties but i expect base class properties included in Users table.
Is there a way to tell CTP include base class properties ? Or what can be alternative solution ?
class PersonDBContext :…

Freshblood
- 6,285
- 10
- 59
- 96
2
votes
1 answer
Cleaning up data within SQLCompact DB between MsUnit tests
I'm playing with MVC2, Entity Framework and CTP4 using code only persistence. I've created some unit tests in MSUnit for my domain objects, including some to see how persistence works in this paradigm. I'm using Sql Server CE 4.0 for these tests. …

Zac
- 697
- 3
- 7
2
votes
0 answers
Junction table with additional payload columns in EF4 CTP4 Code First
I have the following tables:
WOPartList (defines parts that have 1 or more Part_Size)
WOPartSize (defines sizes that have 1 or more Part_Size)
Part_Size (junction table as addt payload columns such as sku, on_hand etc...)
Here are the POCO classes…

Greg Foote
- 171
- 11
2
votes
1 answer
SQL CE 4 System.Transaction support
A similar question was asked here but had no answer.
I am attempting to use a System.Transactions.CommittableTransaction with EF CTP4 and SQL CE 4.
I have created the following transaction attribute for my ASP.NET MVC Controller actions:
public…

Ben Foster
- 34,340
- 40
- 176
- 285
2
votes
1 answer
EF CTP4 when to call context.SaveChanges
I'm trying to replicate many of the practices we use with NHibernate in EF CTP4.
Currently we have a generic repository interface (CTP4 actually makes this quite easy with DbContext.Set).
We are passing in the context and using StructureMap to scope…

Ben Foster
- 34,340
- 40
- 176
- 285
1
vote
1 answer
Code-First: How to create a many to many relationship where the source class/table is the target one as well?
Can someone please post an example on how to create a many to many relationship where the source class is also the target one, using code-first ?
Something like:
Toys * <-----> * Toys
Thank you.
Nuno Senica

csharpnet
- 45
- 4