473,757 Members | 10,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Business Logic


Hello,

I am working on a ASP.NET 1.1 project and would like to set up the web
application to only have one unique Business Logic object that is created
when the client connects. I would like to avoid re-instantiating the object
every time a page is loaded (the connection to the DB are currently in a
PageBase class). I basically would like to be able to re-use the web pages,
call "generic" methods on my Business Logic, so that the web application can
be re-used among other projects that need to display the same information.
In WinForms I would do that in the entry point of the application, but I am
not really sure how to do it in ASP.NET/

Any suggestion?

Thanks.
Mike


Jul 10 '06 #1
2 1605
You can load objects at the start of the application or the start of a
session (whether the logic is the same for one session or all sessions).
Using a static object (Shared in VB.NET), you can set up an Application
scoped object without a lot of work. Simply add a property for the object to
global.asax.{la nguage abbrev.} and fill in the Application_Sta rt event.

The Singleton pattern is essentially the same, although the static object is
held inside the Singleton code.

Across applications is more difficult. You can "share session" across
multiple apps, but you cannot share session objects. This means you have to
persist the data and refresh in each application. As long as the data is
static, you do not have a problem; if it changes often, you are better to
grab and cache the data on a regular cycle (how often depends on the
freshness requirements of the app)>

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"Mike" wrote:
>
Hello,

I am working on a ASP.NET 1.1 project and would like to set up the web
application to only have one unique Business Logic object that is created
when the client connects. I would like to avoid re-instantiating the object
every time a page is loaded (the connection to the DB are currently in a
PageBase class). I basically would like to be able to re-use the web pages,
call "generic" methods on my Business Logic, so that the web application can
be re-used among other projects that need to display the same information.
In WinForms I would do that in the entry point of the application, but I am
not really sure how to do it in ASP.NET/

Any suggestion?

Thanks.
Mike


Jul 10 '06 #2

To follow up on Cowboy's post.

I have a web singleton at:
http://sholliday.spaces.msn.com/ 10/24/2005 entry.

I am using the Session object, its easily converted to an Application
object.

Here are the changes to make... from the code you can get from the blog:
private static string WEB_APPLICATION _OBJECT_GUID =
"D777D4C2-1576-40C3-88F8-FA16E94DDC90";
private static WebApplicationD ataStore singletonInstan ce = null;
private Hashtable m_memoryStore = null;

private WebApplicationD ataStore()
{
this.m_memorySt ore = new Hashtable();
}

public static WebApplicationD ataStore GetInstance()
{
if (null != System.Web.Http Context.Current )
{
if (null != System.Web.Http Context.Current .Application )
{
if (null !=
System.Web.Http Context.Current .Application[WEB_APPLICATION _OBJECT_GUID] )
{
singletonInstan ce =
((WebApplicatio nDataStore)(Sys tem.Web.HttpCon text.Current.Ap plication.Get(W E
B_APPLICATION_O BJECT_GUID)));
}
}
}
if ((singletonInst ance == null))
{
singletonInstan ce = new WebApplicationD ataStore();

System.Web.Http Context.Current .Application.Ad d(WEB_APPLICATI ON_OBJECT_GUID,
singletonInstan ce);
}
return singletonInstan ce;
}

"Mike" <no**@none.comw rote in message
news:Oo******** ******@TK2MSFTN GP04.phx.gbl...
>
Hello,

I am working on a ASP.NET 1.1 project and would like to set up the web
application to only have one unique Business Logic object that is created
when the client connects. I would like to avoid re-instantiating the
object
every time a page is loaded (the connection to the DB are currently in a
PageBase class). I basically would like to be able to re-use the web
pages,
call "generic" methods on my Business Logic, so that the web application
can
be re-used among other projects that need to display the same information.
In WinForms I would do that in the entry point of the application, but I
am
not really sure how to do it in ASP.NET/

Any suggestion?

Thanks.
Mike


Jul 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2189
by: A.V.C. | last post by:
Hello, I stuck in a delimma. Where to put the business logic that involves only one update but N number of selects from N tables........with N where conditions
4
2252
by: Simon Harvey | last post by:
Hello Chaps, Me and a collegue have been talking about where the best place to put business logic is. I think that the best place is where Microsoft suggest - in a seperate business logic layer. The alternative is to have all the logic in with the business entity objects, thus eliminating the business logic layer. The reason that I prefer the seperate layer is because I think its more
5
3139
by: Shibu | last post by:
Hi, I have a situation where I need to convert business objects to a flat table. The reverse is also required. I am using c# and Oracle ODP. I am looking for an easier method to do the below steps. Steps I follows for populating Business Objects is as follows (1) Get a list of records containing various tables joined together from DB using a single PL/SQL (This is a specific requirement, So cannot change the design)
25
5061
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business Logic Layer (BLL) and User Interface Layer (UIL). The problem I found with this was circular referencing...
7
2196
by: Rob R. Ainscough | last post by:
I understand and implement the concept (as best I can), BUT what I would like to know -- how is it possible to completely remove the UI from business logic? "UI references business logic, but business logic should never reference UI." For example, a process that cycles thru datarows in a datatable where after each iteration the UI progress bar needs to be updated (to show a user that something is going on)? To truely remove the...
16
9034
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
6
3801
by: Relaxin | last post by:
I'm coming from Borland C++ and am "somewhat" new to C#, but very seasoned in C++. I'm looking for a specific feature that Borland had that I can't seem to find in C#. In Borland that feature is a DataModule. This is a place where you place all of your Database and business logic. This logic can then be "bound" to your UI by use of Borland Datasource components.
25
2779
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as this application is heavily data-centric around MSDE database. Would it be better to use custom business objects or extend
2
4059
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer and make classes that represent objects/tables. For example, if I have a table named 'tblPersons' I would make a class named 'clsPersons' and a class 'clsPerson' that represents one person/record. In class 'clsPersons' I can make some business...
9
2742
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.