I've got a problem with a dll supplied to me by a someone. they are using entity framework with sql, they have provided me with a dll (for the classes) and I cannot for the life of me get the data into the models in the dll.
If I recreate the sql from scripts I can do it (bu creating my own entity from code), but I need to use the dll to populate data from the db etc.
I have attached the dll and rwl (database connections) https://wetransfer.com/downloads/63970cd823d964a68c50fef904e3697e20200107065132/351fac9f55f3ae92fe985c9a01a69deb20200107065132/1ae840?utm_campaign=WT_email_tracking&utm_content=general&utm_medium=download_button&utm_source=notify_recipient_email
anyone that can help?
this is my code for a local db using the self created entityframework models. but i need to use the dll's models
string connStr = @"Data Source=DESKTOP-5T9EDLN;Initial Catalog=CRM;User Id=sa;Password=PW;Application Name=JobSupervisor;Connection Timeout=120;";
var db = new RWL.DataBase.cDB();
string stre = "select CJ.JobNumber, CJ.SupervisorID, CJ.CustomerName from crm.tbljobs CJ left join [Order] O on O.JobID = CJ.JobID left join materials.OrderCode OC on OC.ID = O.OrderCodeID " +
"left join TaskOrder TOR on TOR.OrderCodeID = OC.ID " +
"left join Projects.Task T on T.ID = TOR.TaskID " +
"left join Projects.ProjectTask PT on PT.TaskID = T.ID " +
"left join Projects.Project P on P.ID = PT.ProjectID " +
"left join Projects.JobProject JP on JP.ProjectID = P.ID " +
"where " +
"PT.ActualStart is NULL " +
"--and P.StartDate IS NOT NULL " +
"--and P.FinishDate IS NULL " +
"order by CJ.JobNumber ";
db.ConnectionString = connStr;
DataTable project = new DataTable();
project = db.GetDataTable(stre);
gridControl1.DataSource = project;
I need to use Linq to SQL to create the query and use dll to populate data, not SQL like in my code above.
Here is the code that works when i create the new entity model "model1" in my winforms project, but like i said, i need to use their dll ("Model.dll"), not my own one.
using (var db = new Model1())
{
var query = from b in db.tblSupervisors
orderby b.Surname
select b;
foreach (var item in query)
{
var obj =
cboSupervisors.Properties.Items.Add(item.FirstName + " " + item.Surname);
}
}
EDIT-Update When trying to use Enable-Migration in nuget package console I now get "Job_Supervisor.DAL.tblJob: : EntityType 'tblJob' has no key defined. Define the key for this EntityType."
It seems like the dll is now being used but it's missing keys, which wouldn't make sense for them to provide this dll then, am I missing something?