2017-02-08 11 views
0

webservice呼び出しを呼び出すときにjoin entiesを挿入するにはどうすればよいですか?SvcClientのコール内部結合はどのようにしてentiteですか?

SELECT 
     distinct [COMMITTEE_MAST_CUST]  
    FROM [PDEV].[dbo].[COM_COMMITTEE_MEMBER] cc Inner join CUSTOMER c 
    on c.MASTER_CUSTOMER_ID = cc.COMMITTEE_MAST_CUST 
    where MEMBER_MAST_CUST = '0827857' and cc.END_DATE > GETDATE() 
and c.CUSTOMER_CLASS_CODE IN ('SECTION_OFFICER','CHAPTER_OFFICER') 

これで今ここでは、上記のクエリを使用してこれをどこに配置するのか分かりません。

SvcClient.Client.Context.ComCommittees.Where(x => x.MemberMasterCustomer 
     == masterCustomerId && x.EndDate > DateTime.Today.AddMonths(-3)).ToList(); 

答えて

0

私はあなたのコンテキストが定義されているかどうかはわかりません(SvcClient.Client.Context.ComCommitteesは[PDEV]に対応しない。[DBO]。[COM_COMMITTEE_MEMBER]?)私はあなたが入れてしまうでしょうと信じています。 .Where節の前に結合します。

このような何か:

SvcClient.Client.Context.ComCommittees.Join(Customer, mast => id.COMMITTEE_MAST_CUST, cust=>cust.MASTER_CUSTOMER_ID, (mast, cust) => new { cc = mast, c = cust }).Where(x => x.MemberMasterCustomer 
     == masterCustomerId && x.EndDate > DateTime.Today.AddMonths(-3)).ToList(); 

クエリ構文でそれを書いて検討する必要がありますが:

var myResult = (from cc in SvcClient.Client.Context.ComCommittees 
join customer in CustomerContext on cc.COMMITTEE_MAST_CUST equals customer.MASTER_CUSTOMER_ID 
where (cc.MemberMasterCustomer == masterCustomerId) && (cc.EndDate > DateTime.Today.AddMonths(-3))).ToList() 

(私はあなたの変数名の一部にわからなかったが、これは基本的なJISTです)

+0

このc.CUSTOMER_CLASS_CODE IN( 'SECTION_OFFICER'、 'C​​HAPTER_OFFICER')はどうですか? – James123

+0

&& ["SECTION_OFFICER"、 "CHAPTER_OFFICER"]。(顧客。 – Chris

関連する問題