Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
T-SQL query to LINQ
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
LINQ
Title:
T-SQL query to LINQ
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01609660
Message ID:
01609660
Views:
69
Hi everybody,

I have Invoices table and Transact table that has an invoice_no column (it is currently not marked as FK to invoices, I sent email asking why).

So, as a result the Invoices class doesn't have navigation to transact.

I have the following query:
select i.invoice_no, i.descrip1, i.date_time,
   (select sum(isnull(t.extension,0.00)) from dbo.transact t where t.invoice_no=i.invoice_no) as extension,
   i.finalized from dbo.invoices i
and this is what I have in C# right now:
 var invoicesList = _dbSet.Where(x => x.Account == accountName && x.Hidden == false).
                Select(x => new InvoicesList { InvoiceNo = x.InvoiceNo, Account = x.Account, Hidden = x.Hidden,
                Descrip = x.Descrip1, Finalized = x.Finalized, Created = x.DateTime});

            if (showFinalized)
            {
                invoicesList = invoicesList.Where(x => x.Finalized == true);
            }
this code is in the Invoices repository class. I'm wondering how can I add the Invoice Balance column into this query.

Once again, right now the transact is not defined as navigation property in the invoices class.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform