I want to replicate this sql query but i'm having dificulty trying to find the solution;
SELECT C.Propref
FROM [dbo].[ClientProperties] C
LEFT OUTER JOIN [dbo].[Properties] P ON C.[PROPREF] = P.[PROPREF] AND P.Contract = 'TXT'
WHERE P.[PROPREF] IS null
This is where I've got up to but the error I get is "Object reference no set to in instance of an object".
var query = (from c in ClientProperties()
join p in db.Properties.Where(wc => wc.Contract == _contractId) on c.Place_reference equals p.Theirref into cp
from found in cp.DefaultIfEmpty()
select new
{
UPRN = c.Place_reference,
}).ToList();
Sorry I'm very much a newbie. ClientProperties is defined as this as its used to collate data from a collation of csv files.
private IEnumerable<ClientProperty> ClientProperties()
{
CsvContext cc = new CsvContext();
if (Directory.Exists(_interfaceInProperty))
{
IEnumerable<ClientProperty> properties = new List<ClientProperty>();
var files = Directory.GetFiles(_interfaceInProperty, "Prop*.csv");
foreach (var f in files)
{
properties = cc.Read<ClientProperty>(f, inputFileDescription);
}
return properties;
}
return null;
}