I have problem adding entity framework model to my project. Here is what I am doing:
1- Right click on project
2- Select add
3- In dialog select data from installed templates.
4- in installed template I cannot see ADO.NET entity framework template.
What should I install?
I use NuGet to install Entity framework 4.2.0.0 but no success.
I am using Visual Studio 2010
EDIT: Look for in the comment of answer for information.
Which method of Entity Framework are you trying to use? The most straightforward (in my opinion) is CodeFirst.
If you are using the wizard to create a model,
(you can do this with an existing database, so the name is a bit of a misnomer)
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
namespace Kiersted.Keps.BusinessObjects
{
[Table("Search", Schema = "mySchema")]
public class BatchSearch : KepsBusinessObject, IKepsBusinessObject
{
public BatchSearch() { }
public BatchSearch(DateTime created)
{
this.Created = created;
}
#region Data Properties
[Key]
[Column("BatchSearchID")]
public int SearchId{ get; set; }
[Column("uidQueueMaster")]
public Nullable<int> uidQueueMaster { get; set; }
[Column("DateCreated")]
public DateTime Created { get; set; }
[Column("DateCompleted")]
public Nullable<DateTime> Completed{ get; set; }
public string QueryTerms { get; set; }
[NotMapped]
public string LocalProperty { get; set; }
}
}
Note: If you are using an existing database, you can either name your classes the same as your tables or add the Table attribute to the class declaration. If you are putting your tables into a different schema (default is dbo) then you will need the Table tag regardless of the name so that you can specify the schema.
Note: If you are using and existing database, you can either name your properties the same as the corresponding fields or you can add the Column attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With