zzz projects Entity Framework 6 EF 6
Home EF Core 5 Articles Knowledge Base Online Examples
  • Home
  • EF Core 5
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

163 results for: in tag: code-first

Using Entity Framework 4.0 with Code-First and POCO: How to Get Parent Object with All its Children?

I'm new to EF 4.0, so maybe this is an easy question. I've got VS2010 RC and the latest EF CTP. I'm trying to implement the "Foreign Keys" code-first example on the EF Team's Design Blog, ...http://blogs.msdn.com/efdesign/archive/2009/10/12/code-only-furt...
code-first entity-framework one-to-many poco
asked by SirEel

EF code first - composite key

I have a legacy database which has two collumns and I want to map them as 1 ID is this possible...for example... public class Product { public string ProductID {get;set;} public string ShortDescription {get;set;} public string UserName {get;set;} } ..
c# code-first entity-framework
asked by server info

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 w...
code-first ctp4 entity-framework
asked by Mark

SQL Server Express connection string for Entity Framework Code First

I am working in Visual Web Developer 2010 Express, and using the Entity Framework code-first CTP. I am able to do this with the new SQL Server CE but I am unable to find a connection string to work with SQL Server Express....This one, using the SQL Server...
code-first connection-string entity-framework sql-server-express
asked by GilShalit

Entity Framework Code First - No Detach() method on DbContext

I'm wondering why there is no Detach method on the DbContext object like there is for ObjectContext.  I can only assume this omission was intentional, but I have a hard time figuring out why.  I need to be able to detach and re-attach entities (for putt...
code-first entity-framework
asked by Brian Sullivan

Why is my DbContext DbSet null?

I created a new Entity Frameworks Code First app and the DbSet (People) is returning null....public class Person { public int Id { get; set; } public string Name { get; set; } } public class Repository : DbContext { public DbSet<Person> Peopl...
code-first ef-code-first entity-framework
asked by Jamey McElveen

EF4 Code-First causes InvalidOperationException

I'm having an issue when trying to run my project each time it builds. It seems the initializer runs, but when it comes to the first query - it dies with the following ...InvalidOperationException.......This operation requires a connection to the 'master'...
c# code-first database ef-code-first entity-framework
asked by Amadiere

Unique Constraint in Entity Framework Code First

Question...Is it possible to define a unique constraint on a property using either the fluent syntax or an attribute? If not, what are the workarounds?...I have a user class with a primary key, but I would like to make sure the email address is also uniqu...
code-first entity-framework unique-constraint
asked by kim3er

Force EF 4.1 Code First to See an Attached entity as Modified

All the examples I've found refer to a class called ObjectContext, which doesn't appear to exist in CTP5. I must stress at this point, CTP5 is my first exposure to the Entity Framework....I have a disconnected POCO that I have attached to my DbContext. Sa...
code-first entity-framework
asked by kim3er

SQLite with EF Code First

After my success using SQLite with NHibernate, I am very happy to use it for testing with Entity Framework Code First....If you have some example connections string and set up demos, that would be great and save a bit of time from my hectic day....Thanks ...
code-first entity entity-framework sqlite
asked by nick

how to annotate a parent-child relationship with Code-First

When using the CTP 5 of Entity Framework code-first library (as announced ...here...) I'm trying to create a class that maps to a very simple hierarchy table....Here's the SQL that builds the table:...CREATE TABLE [dbo].[People] ( Id uniqueidentifier no...
code-first entity-framework
asked by Ralph Shillington

Returning a DataTable using Entity Framework ExecuteStoreQuery

I am working with a system that has many stored procedures that need to be displayed. Creating entities for each of my objects is not practical. ...Is it possible and how would I return a ...DataTable... using ...ExecuteStoreQuery... ?...public ObjectResu...
code-first ef-code-first entity-framework stored-procedures
asked by detroitpro

How do I populate data in Entity Framework code first on database creation?

I'm using code first entity framework and I would like to know how to run some code when the database is being created so that I can populate my database with some data. (note that I'm asking for on database creation, not everytime the application starts)...
code-first ef-code-first entity-framework
asked by ajma

How do i define Keys when working with "EF-Code First"?

I get a ModelValidationException (at the bottom) when working with "EF-Code First". It wants me to define a Key but I'm not sure what exactly it means......public class Unit { Guid id; String public_id; String name; bool deleted; }...
asp.net c#-4.0 code-first entity-framework
asked by gingerbreadboy

Entity Framework DateTime and UTC

Is it possible to have Entity Framework (I am using the Code First Approach with CTP5 currently) store all DateTime values as UTC in the database?...Or is there maybe a way to specify it in the mapping, for example in this one for the last_login column:..
c# code-first datetime entity-framework utc
asked by Fionn

How to configure ProviderManifestToken for EF Code First

I have a asp.net MVC3 project using EF code-first. For my unit testing I have been using SQL Server CE 4.0 and SQL Server 2008 Express. Both have worked perfectly with EF generating my database as expected....However, when I run my application outside of ...
code-first connection-string entity-framework
asked by trevorc

Entity Framework Code First, foreign key/object should not save

I have three classes, like so:...[DataContract] public class ApplicationDto : BusinessBase<int> { /// <summary> /// Gets or sets the name. /// </summary> /// <value>The name.</value> [DataMember] public string Name { get; set; } ...
c# code-first entity-framework
asked by MartinHN

Generate SQL CE database from EF Code-First DbContext class

I've defined a set of classes in the style of Entity Framework Code-First conventions and annotated the class properties with System.ComponentModel.DataAnnotations attributes....Now I want to generate a SQL Server Compact Edition (SCSE) (4.0) database fro...
.net code-first ef-code-first entity-framework sql-server-ce
asked by Bent Rasmussen

Does Entity Framework Code First support stored procedures?

I've watched several presentations of EF Code First and haven't seen how EFCF works with stored procedures....How can I declare a method that will use some sp? Can I pass an entity to a method that calls sp without manually mapping entity properties to sp...
c# code-first entity-framework stored-procedures
asked by frennky

How to update a row using Entity Framework code first?

How should I go about updating a row in the database? There is no update method, and if I use add and the primary key id already exists, I get an exception. Please provide an example if possible.
code-first entity-framework
asked by Ryan

Page 1 of 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now