console application
_____________________
entity framework
______________________
in runtime i receive this message
Unable to update the EntitySet 'T_Cars' because it has a DefiningQuery and no <insertfunction> element exists in the <modificationfunctionmapping> element to support the current operation
______________________________________________
table name and fields
SELECT TOP 1000 [CarID]
,[Brand]
,[Model]
FROM [EntityFW].[dbo].[T_Cars]
___
___________________________________________
in file app.config
__________________________
<configuration>
<connectionstrings>
<add name="DBEntityFW_Entities" connectionstring="metadata=res://*/BusinessObject.csdl|res://*/BusinessObject.ssdl|res://*/BusinessObject.msl;provider=System.Data.SqlClient;provider connection string="Data Source=YAZDAN3-PC;Initial Catalog=EntityFW;User ID=Login_Boss;Password=123;MultipleActiveResultSets=True"" providername="System.Data.EntityClient" />
</connectionstrings>
</configuration>
______________________________________________
namespace EntityFrameWorkExample
{
class Program
{
static void Main(string[] args)
{
Insert();
}
static void Insert()
{
DBEntityFW_Entities DBase = new DBEntityFW_Entities();
T_Cars objT_Cars_Add = new T_Cars();
objT_Cars_Add.Brand = "Ford";
objT_Cars_Add.Model = "195";
DBase.T_Cars.AddObject(objT_Cars_Add);
DBase.SaveChanges();
Console.WriteLine("car add to the database");
Console.ReadLine();
}
}
}
[Edit]Code block added[/Edit]