Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
T-SQL query to LINQ
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
T-SQL query to LINQ
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01609660
Message ID:
01609660
Vues:
70
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform