I am working on a simple command line app to teach myself some LINQ to SQL in C#. I have a SQL Server 2008 instance and I am trying to look in MSDB for the Jobs currently setup on the SQL Server. I want to output the Job Name a dot and the Step name and the actual SQL statement to do that is the following:
use msdb
go
select j.name + '.' + s.step_name
from sysjobs j
join sysjobsteps s on j.job_id = s.job_id
order by j.name
go
I am at a loss for how to establish the relationship between SysJobs and SysJobSteps in the C# code and I keep getting the following error message:
System.InvalidOperationException: Invalid association mapping for member
'ServerCompare.Lib.Commands.SysJob.SysJobSteps'.
'ServerCompare.Lib.Commands.SysJob' is not an entity.
Please advise what is the best way to do this?
Both tables must have a defined primary key. Use Column(Name="whatever_id", IsPrimaryKey=true)
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