Releasing SoftPro license programatically..

Discussions related to custom development with Select.
Post Reply
merak.marey
Posts: 14
Joined: Fri Oct 30, 2020 10:41 am

Releasing SoftPro license programatically..

Post by merak.marey »

There is a couple of questions I want to ask:

through the sdk and using the same user, every time I open an order a license is consumed?

if so, how can I programmatically release that license to ensure greater availability for other process?

if not, does that mean that a single user log on will only consume a single license?

how the SP UI does it?


----

Here's the code I have

Code: Select all

try
            {
                NetworkCredential creds = new NetworkCredential(username, password);
                using (SelectServer ss = new SelectServer(new Uri(spserver), creds))
                {
                    string reason;

                    ss.ChooseProfile += new EventHandler<ChooseProfileEventArgs>(chooseProfile);


                    if (!ss.TryAuthenticate(out reason))
                    {
                        lastError = "SoftPro Access was denied";
                        _log.Error(lastError +". " + reason);
                        // Write login failure reason to console and exit.
                        Console.WriteLine(reason);
                        return false;
                    }
                    IOrderStore os = ss.GetService<IOrderStore>();
                }
            }
catch () {}
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Releasing SoftPro license programatically..

Post by BobRichards »

Through the sdk and using the same user, every time I open an order a license is consumed?
Creating a new instance of SelectServer (SelectServer ss = new SelectServer(new Uri(...)) will consume a license. Select doesn't care that the same user has created additional SelectServer instances and will treat each instance as reserving a license. Creating a second instance of SelectServer in the same application is wasteful and unnecessary.
if so, how can I programmatically release that license to ensure greater availability for other process?
When you close the SelectServer instance, the license will be made available to others. I would think that it is available for reuse quickly.
if not, does that mean that a single user log on will only consume a single license?
As above, Select will need a license for each SelectServer instance. It doesn't matter if it is the same user credentials or not.
how the SP UI does it?
No differently. When the user closes the application, the UI closes the SelectServer instance it created when the application was started.

** Also note, there is no need to cross-post multiple message boards. I see all the messages no-matter where they are posted. **
Bob Richards, Senior Software Developer, SoftPro
merak.marey
Posts: 14
Joined: Fri Oct 30, 2020 10:41 am

Re: Releasing SoftPro license programatically..

Post by merak.marey »

H Bob!

Thanks for the prompt answer, and my apologies for the multiple posts...I was getting an error from the phpBB everytime I tried to post, that's why tried different places.

So, the solution would be to only use a single instance of the SelectServer which only consume a single license...correct?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Releasing SoftPro license programatically..

Post by BobRichards »

Yes. You got it.
Bob Richards, Senior Software Developer, SoftPro
merak.marey
Posts: 14
Joined: Fri Oct 30, 2020 10:41 am

Re: Releasing SoftPro license programatically..

Post by merak.marey »

Thanks Bob!
Post Reply