This has been solved.

For anyone that is interested, it has to do with the foreign key in the
DBML.
If the foreign key is not nullable it will do an inner join.
If you make the field nullable then it will do a left join.


On 23 September 2010 10:28, David Burela <david.bur...@gmail.com> wrote:

> I am using LinqToSql on a project, and Ria services to expose it as an
> IQueryable.
> I want to send my Product table along with its child tables (e.g.
> ProductStatus, ProductCategory)
>
> To do this I am using the standard
>
> public IQueryable<Product> ProductSelect()
>
> {
>     DataLoadOptions loadOpts = new DataLoadOptions();
>     loadOpts.LoadWith<Product>(p => p.ProductStatus);
>
>     loadOpts.LoadWith<Product>(p => p.ProductCategory);
>     this.DataContext.LoadOptions = loadOpts;
>     return this.DataContext.Products;
> }
>
>
> Unfortunately this is creating inner joins, not left joins. There isn't
> referential integrity on the tables (I can't add it in). This means if the
> there isn't a matching record in the child table, then the product will not
> be selected.
> Does anyone know how to change this to be a left join?
>
> -David Burela
>

Reply via email to