I don't quite understand how adding a webservice to my project would
really help, but maybe its cause I'm not a developer.

Here are the basics of my class file and how I open and manage sessions
and file.

-us1 is a public UniSession variable declared in my class file (DAL.cs).
This way I can create a session from a webpage and use it in my class
file without having to pass the session around.

Obviously OpenUniSession returns an active unisession, and
CloseUniSession closes it.  GetUniFile reads the specified file for its
(FileKey) "key" - "ItemID" - "Sequence number" whatever the primary key
is called.

This is what I have in my class file (called DAL).  

public UniSession us1;

public UniSession OpenSession()
{
return UniObjects.OpenSession(xxxx);
}
public void CloseUniSession(ref UniSession us1)
{
UniObjects.CloseSession(us1);
}
public UniDynArray GetUniFile(string FileName, string FileKey)
{
return us1.CreateUniFile(FileName).Read(FileKey)
}
public string GetClientID(string ClientName)
{
return GetUniFile(UNIFILENAMEHERE, ClientName).Extract(1).ToString();
}

This is what would be in a web page
DAL.us1 = DAL.OpenUniSession();
Response.Write(DAL.GetClientID("CLIENTNAMEHERE");
DAL.CloseUniSession(ref DAL.us1);

So you can see why I ask if I need to close the file, because in this
setup I'm not specifically closing it.  

I also wanted to be able to create one variable that would hold the
current UniSession while a given page is processing.  I currently have
several functions that call other functions to get specific files from
GetUniFile().  

Example would be something like this : Function A would get my clients
by company and return a datatable.  Function B would get the peopleID's
for a given company and return a unidynarray.  Function C would get the
individual person based on the personID from function B and return a
unidynarray.

So lots of looping and lots of calls back to GetUniFile, as GetUniFile
would be called in both Function B and C to get their respective Files.


I tried database commands but that was incredibly slow.  

My next step is connection pooling so when a user open's up a page there
is automatically a connection available (instead of opening one and
storing it in the DAL.us1 variable).  I have 64 users, but based on
demand and Universe's speed I'm thinking a min pool of 5 licenses should
be plenty.

I did call my vendor to verify that connection pooling was setup and I
was allowed to use it.

So what's the consensus, is this a feasible way to handle session's and
read files?

Symeon
-I don't quite understand what your doing with the code you wrote.  Ya
it loops around and creates sessions, but how does the application pick
up an open one??

Jon


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Symeon Breen
Sent: Tuesday, August 28, 2007 9:01 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Learning Uniobjects.NET

Hi Jonathon

As far as I am aware, connection pooling will work in an asp.net
environment. The connection is then shared by the web users, not sure if
this would be restricted to the application pool or not tho (it is
something I am going to be doing very soon). You need to buy a special
connection pooling licence for this, IBM would be willing to talk with
regard pricing and they are very flexible these days.

Alternatively each connection is only alive for the duration of the web
request so if you keep each operation fairly small and fast you may not
have too many problems. Remember if you have device licensing you can
have the first ten concurrent connections taking only 1 licence. Having
said that - if you do not have enough licences to serve your number of
users then you really should up the number of licences that you have ;)

One trick I do for a couple of webservices that are in and out of u2 in
sub second times is loop round the connect 20 times with a 10th of a
second pause in between each connect. That way I can wait a second or
two to grab a free connection.
  E.g -

            For i = 1 To 20
                Try
                    Sess = UniObjects.OpenSession(lHostName, lSessUser,
lSessPass, lAccount, lServiceType)
                Catch ex As Exception
                    errMsg = ex.Message
                End Try
                If errMsg = String.Empty Then Exit For
                System.Threading.Thread.Sleep(100)
            Next
            If errMsg <> String.Empty Then
                CloseSess(Sess)
                ErrorMessage(errMsg)
            End If


In theory .net and uniobjects.net are very good at tidying up after
themselves. However I think it is good practice to always close files,
sessions etc and setting their handles to Empty. Remember the way
asp.net works is that each postback is one process and you will need to
connect, use and close within each postback - as I mention below, doing
this via a webservice makes it easier to understand and more atomic.

As far as your architecture is concerned I would thoroughly recommend
setting up a class for all your uniobject operations, I would also set
up a web service(s) for all your actions back to the server, then your
front end can be coded against the web service rather than uniobjects
and u2 directly. (soa, n-tier etc and all that ;)

If you have any more specific questions please do ask


Hth
Symeon.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jonathan
Lienhoop
Sent: 27 August 2007 20:38
To: u2-users@listserver.u2ug.org
Subject: [U2] Learning Uniobjects.NET

I am new to .NET and uniobjects for .net and have been given the task of
writing a web based program that can pull data out of our universe
database.  I am running AIX 5.2 Universe 10.1.7.  My question is to make
sure I'm using session's and files appropriately.



1st - Is there anyway to implement something like connection pooling in
a C# .NET 2005 web application??  So far I have read that it only works
in a windows application.  I want to have some way of calling a
connection to the DB once, perform many read operations and then close
the session.  I don't have enough licenses, to maintain an open session
for each user that accesses my program.



2nd - After I read a file, is there anything I need to do (like closing
the file)?  If not, when do I need to close the file?
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to