Hi,
I am using **console application** to insert data into .mdf file which is in App_Data folder and .edmx file in project folder.
The same below code is working with mvc but not console application.
Table is:
CREATE TABLE [dbo].[tbLegalDetails] (
[LegalStatusId] INT NOT NULL,
[LegalStatusName] TEXT NULL,
[LegalStatusHeading] TEXT NULL,
[PatentOfInvention] NVARCHAR (100) NULL,
[EventCode] VARCHAR (100) NULL,
[EventExplination] TEXT NULL,
[CCOfCorrespondingPatent] NVARCHAR (100) NULL,
[CorrespondingPatentD] INT NULL,
PRIMARY KEY CLUSTERED ([LegalStatusId] ASC)
);
Code to insert data is:
ConsoleApplication__DynamicWebBrowserDatabaseEntities db = new ConsoleApplication__DynamicWebBrowserDatabaseEntities();
List<tbLegalDetail> hLegalDetaili = db.tbLegalDetails.ToList();
[Here count is shown as 0]
tbLegalDetail tbLegalDetail = new tbLegalDetail();
tbLegalDetail.LegalStatusId = 3;
tbLegalDetail.LegalStatusName = "INPADOC legal";
tbLegalDetail.LegalStatusHeading = "COMPOSITIONS ANDAPY";
tbLegalDetail.PatentOfInvention = "2003287377";
tbLegalDetail.EventCode = "FGA";
tbLegalDetail.EventExplination = "LETTSTANDARD PATENT";
tbLegalDetail.CCOfCorrespondingPatent = "dfs";
tbLegalDetail.CorrespondingPatentD = 1212;
db.tbLegalDetails.Add(tbLegalDetail);
db.SaveChanges();
List<tbLegalDetail> hLegalDetail = db.tbLegalDetails.ToList();
[Here count is shown as 1]
Console.ReadLine();
but when I look into the .mdf file I cant see the added row.
When I run again I will show count as 0.
Please help.
What I have tried:
I tried to change the locations of the mdf and .edmx files from project folder to App_Data (both in same, one in each)
But did not work for me
When I try to create .edmx file it says
"The connection you selected uses a local data file that is not in the current project.Do you want to copy it to project." which I don't get in MVC though .mdf file is in App_Data folder.
.