I am new to nHibernate but I love it.  It has reduced
program code in a new app probably by 60% which is unbelievable.
LESS CODE MAINTENANCE!!!

I have a problem I can't seem to solve.
I need a list of vendors that a customer does NOT have in their list.

using System.Linq;
using System.Linq.Expressions;
using NHibernate.Linq;
using NHibernate.Linq.Expressions;


Example List Data to the classes below
------------
    LIST Supplier Class
    101 , SupplierName1
    102 , SupplierName2
    103 , SupplierName3
    104 , SupplierName4
    105 , SupplierName5

    LIST Customer Class for CustomerId = 9999
    9999 , CustomerName1 , supplierBase=(101 , SupplierName1)
    9999 , CustomerName1 , supplierBase=(104 , SupplierName4)
    9999 , CustomerName1 , supplierBase=(105 , SupplierName5)


public class Supplier
{
    public virtual int SupplierId;
    public virtual string SupplierName;
}

public class Customer
{
    public virtual int CustomerId ;
    public virtual string CustomerName;
    public virtual SupplierBase supplierBase { get; set; } << contains
SupplierId and other info
}

I created a list of ALL vendors:
    var vListSupplier = (from suppliers in Session.Linq<Supplier>()
                         select suppliers).ToList();


I created a list for a SPECIFIC customer and the vendors they use:
    var vListCustomer = (from customers in Session.Linq<Customer>()
                         where customers.CustomerId = 9999
                         select customers).ToList();

I can easily get a list of VENDORS that that a specific customer uses:
    var oLst2 = (From a In vListSupplier
                 Join b In vListCustomer On a.SupplierId Equals
b.supplierBase.SupplierId
                 Select a).ToList();

HEY ... it might seem easy to you ...
    but it took me a day to get this far. :)
Then it took me another day
    NOT to be able to figure-out a solution to the following.

I need a list of vendors that a customer does NOT have in their list.
(Not in the vListCustomer list.)

I just do not know what I am missing.  I have tried example
after example on the web but most of the examples show
the LISTs being compared as exactly the same.

I have used the LINQ "Except" function but that requires
the objects be identical in structure.

I hope the above was understandable.  Can you please help?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to