csharp 创建Epicor BO Instace WCF

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 创建Epicor BO Instace WCF相关的知识,希望对你有一定的参考价值。

/*
    Get an Epicor Client from WCF 

    Required Dll:
    Epicor.ServiceModel
    Erp.Contract.BO.Customer (or whatever BO you need)
    System.ServiceModel


    Usage:
    var wcfBinding = NetTcp.UsernameWindowsChannel();
    EndpointIdentity epid = EndpointIdentity.CreateSpnIdentity("dummy"); //Optional
    var soClient = GetEpicorClient<SalesOrderImpl>(wcfBinding, new Uri(string.Format("net.tcp://{0}/ERP/BO/SalesOrder.svc", Settings.Default.EpicorServer, "user","password"))); 
*/
public static ImplBase<T> GetEpicorBOInstance<T>(CustomBinding binding, Uri appServer, string userName, string password, EndpointIdentity epi=null) where T : class
{
    ImplBase<T> epicorClient = new ImplBase<T>(binding, appServer,epi);
    epicorClient.ClientCredentials.UserName.UserName = userName;
    epicorClient.ClientCredentials.UserName.Password = password;
    return epicorClient;
}

//No Cast Needed for this one 
// Usage 
//SalesOrderImpl impl = GetEpicorBOInstance<SalesOrderImpl, SalesOrderSvcContract>(wcfBinding, new Uri(string.Format("net.tcp://{0}/ERP/BO/SalesOrder.svc", Settings.Default.EpicorServer)), Settings.Default.EpicorUser, Settings.Default.EpicorPassword);
public static TImpl GetEpicorBOInstance<TImpl, TContract>(CustomBinding binding, Uri appServer, string userName, string password, EndpointIdentity epi = null) 
            where TImpl : ImplBase<TContract>
            where TContract : class
{
    
    TImpl client=(TImpl)Activator.CreateInstance(typeof(TImpl), binding, appServer, epi);
    client.ClientCredentials.UserName.UserName = userName;
    client.ClientCredentials.UserName.Password = password;

    return client;
}

以上是关于csharp 创建Epicor BO Instace WCF的主要内容,如果未能解决你的问题,请参考以下文章

csharp Epicor标准练习片段

csharp Epicor 10.1 - 获得价值或0

csharp Epicor UD Entry KeyField

csharp 的Epicor-WCF-j.cs

csharp Epicor 10.1从代码调用BAQ

csharp Epicor:从午夜到实际时间转换秒数