Solved

good use of my unit of work?

Posted on 2012-03-23
1
157 Views
Last Modified: 2012-03-27
Hi,

I have the following page load method:
 
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (var db = new PublicUnitOfWork())
            {                
                DisplayPageCMS(litPageTitle, litMetaKeywords, litMetaDescription, litBodyText, db);
            }
        }
    }

Open in new window


It calls the following method in my base class:
public void DisplayPageCMS(Literal litPageTitle,Literal litMetaKeywords ,Literal litMetaDescription,Literal litBodyText, PublicUnitOfWork db)
    {
        Page p = db.Pages.FindById(1);

        //do some work to set the lit values of my meta tags etc
    }

Open in new window


I'm just wondering is the best way to use my PublicUnitOfWork or should the base class function be creating its own.

Note in my page load I may want to use the publicunitofwork some more for other things...

I'd appreciate some input/feedback on this.

Thanks
0
Comment
Question by:scm0sml
1 Comment
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 37758051
If you are going to PublicUnitofWork in yur page_load for other things then what you are doing is fine, why create a 2nd instance when you already have created one.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question