我目前有兩個項目的solutuion。EF我是否需要將其安裝在引用項目的項目中,該項目已與EF
一個名爲領域的空白項目,該項目已安裝等EF
現在我有一個C#項目的形式,使得使用域項目。
當我做從格蘭形式出現以下錯誤域項目要求:
Additional information: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
我需要在表格項目安裝EF?
這裏是我的領域工程類:
/// <summary>
/// Provides Operations to the databse regarding all Service History Requests
/// </summary>
public class EFServiceStatusHistoryRepository
{
public void SubmitEntry(int ServiceId, string Status, string Messages, DateTime LastUpdated)
{
try
{
ServiceStatusHistory tmp = new ServiceStatusHistory();
using (var db = new EFDbContext())
{
tmp.Service = db.Services.Find(ServiceId);
tmp.Status = (ServiceStatus)Enum.Parse(typeof(ServiceStatus), Status);
tmp.SetMessages(Messages);
tmp.time = DateTime.Now;
tmp.LastUpdateTime = LastUpdated;
db.ServiceStatusHistory.Add(tmp);
db.SaveChanges();
}
}
catch
{
}
}
}
然後我把它在形式的項目:
EFServiceStatusHistoryRepository service = new EFServiceStatusHistoryRepository();
service.SubmitEntry(bla,bla,bla);
這是我的理解只有域項目所需要安裝的EF。作爲我所調用的函數,所有EF都在該項目中工作,然後將List返回給表單項目?
在Forms項目中? – Zapnologica