E10: Proper way to close a connection from external app

Ok Joe,
Either way the code is fairly similar and it uses the same Contracts and BO's so the conversion to this might be pretty easy. No matter which way you do it in E10 you are using the web services since the whole thing runs on IIS / WCF but this way is a little simpler since you don't have to establish a session directly like on your example code , nor do you need to use the config files

Either way on your example as long as you invoke Close() (if available) and Dispose() on your Session Object and your BO you should be ok. If the Session Object implements IDisposeable I would change your instanciation to a Using to ensure it always gets closed. LIke this

using(Session EpiSession = new Session("***", "***", Session.LicenseType.Default, @"C:\Epicor\ERP10.0ClientTest\Client\config\ERP10.sysconfig"))
{
      ILauncher EpiLaunch = new ILauncher(EpiSession);Â
}






Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Tue, Jan 19, 2016 at 9:36 AM, Joe Rojas jrojas@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Thanks Jose.

I will definitely keep it mind to use web services going forward.
This is for an existing app that that we used for E9 that I am updating to work with E10 so I will likely just continue to use the BO’s in this case.

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 19, 2016 9:29 AM
To: Vantage <vantage@yahoogroups.com>
Subject: Re: [Vantage] E10: Proper way to close a connection from external app


Joe,
You should be using the web services via the Contract and those are stateless WCF Services wich you can just invoke .Close(); and Dispose() (or dispose it via Using)

var wcfBinding = NetTcp.UsernameWindowsChannel();

var appServer = new Uri("net.tcp://localhost/epicor10/erp/bo/part.svc");

using (var partClient = new PartImpl(wcfBinding, appServer))

{

partClient.ClientCredentials.UserName.UserName = "Manager";

partClient.ClientCredentials.UserName.Password = "Epicor123";

bool morePages;

var myPartDataset = partClient.GetList("", 10, 1, out morePages);

foreach (var partRec in myPartDataset.PartList.Rows.Cast<PartListDataSet.PartListRow>())

{

Console.WriteLine(partRec.PartNum);

}

partClient.Close();

}


Jose C Gomez
Software Engineer

T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>

Quis custodiet ipsos custodes?

On Tue, Jan 19, 2016 at 9:17 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:


Hi All,

I have seen several examples of how to create a connection to E10 from an external application but I’ve never seen the entire code to see how to properly close the connection the connection.

For example, if I have:
Session EpiSession = new Session("***", "***", Session.LicenseType.Default, @"C:\Epicor\ERP10.0ClientTest\Client\config\ERP10.sysconfig");
ILauncher EpiLaunch = new ILauncher(EpiSession);

Do I just dispose of the session object and set both to null or is there a better way to close the connection to the server?

[cid:9a0e62.png@f6dbf8c4.4db889b4]


Joe Rojas
Director of Information Technology
(781) 408-9278<tel:%28781%29%20408-9278> Mobile
(781) 573-0291<tel:%28781%29%20573-0291> Local
(781) 232-5191<tel:%28781%29%20232-5191> Fax


[http://matsinc.com/images/e-mail-signatures/tagline.jpg]
[http://matsinc.com/images/e-mail-signatures/graphics/logo_matsinc.png]<http://matsinc.com> [http://matsinc.com/images/e-mail-signatures/graphics/icon_twitter.png] <http://twitter.com/Mats_Inc> [http://matsinc.com/images/e-mail-signatures/graphics/icon_facebook.png] <http://www.facebook.com/commercial.flooring> [http://matsinc.com/images/e-mail-signatures/graphics/icon_youtube.png] <http://www.youtube.com/user/MatsIncTV> [http://matsinc.com/images/e-mail-signatures/graphics/icon_pinterest.png] <http://www.pinterest.com/contractfloors/> [http://matsinc.com/images/e-mail-signatures/graphics/icon_blog.png] <http://matsinc.com/blog>


[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]

</div><span class="ygrps-yiv-550280666">
 


<div style="color:#fff;min-height:0;"></div>


Hi All,

I have seen several examples of how to create a connection to E10 from an external application but I’ve never seen the entire code to see how to properly close the connection the connection.

For example, if I have:
Session EpiSession = new Session("***", "***", Session.LicenseType.Default, @"C:\Epicor\ERP10.0ClientTest\Client\config\ERP10.sysconfig");
ILauncher EpiLaunch = new ILauncher(EpiSession);

Do I just dispose of the session object and set both to null or is there a better way to close the connection to the server?

[cid:9a0e62.png@f6dbf8c4.4db889b4]


Joe Rojas
Director of Information Technology
(781) 408-9278 Mobile
(781) 573-0291 Local
(781) 232-5191 Fax


[http://matsinc.com/images/e-mail-signatures/tagline.jpg%5d
[http://matsinc.com/images/e-mail-signatures/graphics/logo_matsinc.png%5d<http://matsinc.com> [http://matsinc.com/images/e-mail-signatures/graphics/icon_twitter.png%5d <http://twitter.com/Mats_Inc> [http://matsinc.com/images/e-mail-signatures/graphics/icon_facebook.png%5d <http://www.facebook.com/commercial.flooring> [http://matsinc.com/images/e-mail-signatures/graphics/icon_youtube.png%5d <http://www.youtube.com/user/MatsIncTV> [http://matsinc.com/images/e-mail-signatures/graphics/icon_pinterest.png%5d <http://www.pinterest.com/contractfloors/> [http://matsinc.com/images/e-mail-signatures/graphics/icon_blog.png%5d <http://matsinc.com/blog>



[Non-text portions of this message have been removed]
Joe,
You should be using the web services via the Contract and those are stateless WCF Services wich you can just invoke .Close(); and Dispose() (or dispose it via Using)
var wcfBinding = NetTcp.UsernameWindowsChannel();
    var appServer = new Uri("net.tcp://localhost/epicor10/erp/bo/part.svc");
    using (var partClient = new PartImpl(wcfBinding, appServer))
    {
        partClient.ClientCredentials.UserName.UserName = "Manager";
        partClient.ClientCredentials.UserName.Password = "Epicor123";
        bool morePages;
        var myPartDataset = partClient.GetList("", 10, 1, out morePages);
        foreach (var partRec in myPartDataset.PartList.Rows.Cast<PartListDataSet.PartListRow>())
        {
            Console.WriteLine(partRec.PartNum);
        }
        partClient.Close();
    }


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Tue, Jan 19, 2016 at 9:17 AM, Joe Rojas jrojas@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Hi All,


I have seen several examples of how to create a connection to E10 from an external application but I’ve never seen the entire code to see how to properly close the connection the connection.

For example, if I have:
Session EpiSession = new Session("***", "***", Session.LicenseType.Default, @"C:\Epicor\ERP10.0ClientTest\Client\config\ERP10.sysconfig");
ILauncher EpiLaunch = new ILauncher(EpiSession);

Do I just dispose of the session object and set both to null or is there a better way to close the connection to the server?

[cid:9a0e62.png@f6dbf8c4.4db889b4]


Joe Rojas
Director of Information Technology
(781) 408-9278 Mobile
(781) 573-0291 Local
(781) 232-5191 Fax


[http://matsinc.com/images/e-mail-signatures/tagline.jpg]
[http://matsinc.com/images/e-mail-signatures/graphics/logo_matsinc.png]<http://matsinc.com> [http://matsinc.com/images/e-mail-signatures/graphics/icon_twitter.png] <http://twitter.com/Mats_Inc> [http://matsinc.com/images/e-mail-signatures/graphics/icon_facebook.png] <http://www.facebook.com/commercial.flooring> [http://matsinc.com/images/e-mail-signatures/graphics/icon_youtube.png] <http://www.youtube.com/user/MatsIncTV> [http://matsinc.com/images/e-mail-signatures/graphics/icon_pinterest.png] <http://www.pinterest.com/contractfloors/> [http://matsinc.com/images/e-mail-signatures/graphics/icon_blog.png] <http://matsinc.com/blog>


[Non-text portions of this message have been removed]

</div>
 


<div style="color:#fff;min-height:0;"></div>

Thanks Jose.
I will definitely keep it mind to use web services going forward.
This is for an existing app that that we used for E9 that I am updating to work with E10 so I will likely just continue to use the BO’s in this case.

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 19, 2016 9:29 AM
To: Vantage <vantage@yahoogroups.com>
Subject: Re: [Vantage] E10: Proper way to close a connection from external app


Joe,
You should be using the web services via the Contract and those are stateless WCF Services wich you can just invoke .Close(); and Dispose() (or dispose it via Using)

var wcfBinding = NetTcp.UsernameWindowsChannel();

var appServer = new Uri("net.tcp://localhost/epicor10/erp/bo/part.svc");

using (var partClient = new PartImpl(wcfBinding, appServer))

{

partClient.ClientCredentials.UserName.UserName = "Manager";

partClient.ClientCredentials.UserName.Password = "Epicor123";

bool morePages;

var myPartDataset = partClient.GetList("", 10, 1, out morePages);

foreach (var partRec in myPartDataset.PartList.Rows.Cast<PartListDataSet.PartListRow>())

{

Console.WriteLine(partRec.PartNum);

}

partClient.Close();

}


Jose C Gomez
Software Engineer

T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez> [Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by sender.] <http://www.josecgomez.com/feed/>

Quis custodiet ipsos custodes?

On Tue, Jan 19, 2016 at 9:17 AM, Joe Rojas jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:


Hi All,

I have seen several examples of how to create a connection to E10 from an external application but I’ve never seen the entire code to see how to properly close the connection the connection.

For example, if I have:
Session EpiSession = new Session("***", "***", Session.LicenseType.Default, @"C:\Epicor\ERP10.0ClientTest\Client\config\ERP10.sysconfig");
ILauncher EpiLaunch = new ILauncher(EpiSession);

Do I just dispose of the session object and set both to null or is there a better way to close the connection to the server?

[cid:9a0e62.png@f6dbf8c4.4db889b4]


Joe Rojas
Director of Information Technology
(781) 408-9278<tel:%28781%29%20408-9278> Mobile
(781) 573-0291<tel:%28781%29%20573-0291> Local
(781) 232-5191<tel:%28781%29%20232-5191> Fax


[http://matsinc.com/images/e-mail-signatures/tagline.jpg%5d
[http://matsinc.com/images/e-mail-signatures/graphics/logo_matsinc.png%5d<http://matsinc.com> [http://matsinc.com/images/e-mail-signatures/graphics/icon_twitter.png%5d <http://twitter.com/Mats_Inc> [http://matsinc.com/images/e-mail-signatures/graphics/icon_facebook.png%5d <http://www.facebook.com/commercial.flooring> [http://matsinc.com/images/e-mail-signatures/graphics/icon_youtube.png%5d <http://www.youtube.com/user/MatsIncTV> [http://matsinc.com/images/e-mail-signatures/graphics/icon_pinterest.png%5d <http://www.pinterest.com/contractfloors/> [http://matsinc.com/images/e-mail-signatures/graphics/icon_blog.png%5d <http://matsinc.com/blog>


[Non-text portions of this message have been removed]




[Non-text portions of this message have been removed]