Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Desktop Architecture Questions 1

Status
Not open for further replies.

jmeckley

Programmer
Jul 15, 2002
5,269
US
This is more a design question than a c# question, but I cannot locate a better forum. Appologies if a better forum exists.

I'm about to create my first desktop app. up to this point I have designed web applications using MVP with webforms.
The desktop app is very simple.
1. select 1 of 2 reports
2. enter parameters specific to that report
3. generate a pdf from a crystal report

I can quickly do all this for web app, but only one user is getting this app, so a simlpe desktop app was decided on.

specific questions?
1. Where do I initialize IoC? in a web app I use the HttpAppliation.Application_Start().
2. Where would I manage a UOW? in a web app I use the HttpAppliation.Begin_Request() and HttpAppliation.End_Request().
3. With web apps just about everything is a string when binding data. first I parse the value. then pass this value (usually id) to the service layer load domain from repository and process logic. With a desktop app can I bind the acutal collection to the enumerable control and work directly with this object, correct?

Quick example
Bind list of customers to a dropdown list.
select a customer.
pass customer to service fascade, which generates report

with a web application I would parse the customer id from the selected value property.
pass the id to the service, the service would fetch the customer and generate the report.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
1. void main or a method tha is called from void main or worst case form constructor of the main form (only needed if you select enable application framework in the startup project.
2. UOW (unit of work?) NOt sure if this can be approached the same way since webapps are supposed to be stateless while winforms are statefull.
3. yes, but watch out for pitfalls in .net 2.0 (less of an issue in 3.5). But if you use a bindingsource you should be fine, comboboxes inside a datagridview are a bit quirky (you need to add a self property to you objects to make them work or subclass them to hold the self with generics).



Christiaan Baes
Belgium

My Blog
 
UOW = unit of work. specifically nhibernate (using Rhino Tools). I'm trying to determine a good place to open a new session/transaction.
For this simple app I won't need a gridview. probally just 1 form (select a report) and 2 panes (1 for each report).

in a web app. I export crystal to a stream, covert to a byte array and send to the response. form a coding POV no file is actually gerenated (technicially it's generated somewhere, but I can't remember).
On a client app could I open a file if the file only existed in memory (memory stream, not a file stream)?

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
yes you can open a memorystream at least I know I can make an image out of memorystream not sure about all the filetypes but I guess so.

Well since I don't use the lazy-loading of nhibernate I just open and close a session per request or use the currentsession. depends on what you want. If you want lazy-loading then you have to keep the session open. Are you still using a DAO pattern or not? Or are you calling the repositories directly from your controllers?

Christiaan Baes
Belgium

My Blog
 
I use Ayende's Rhino Tools Repository<> and UnitOfWork. with a webapp it's real simple... use Rhino.Commons.Http.UnitOfWorkApplication. from my presenters I initialize a transaction, if necessary.
my service fascade calls Repository<>.

for this app being so tiny the controller may be the best place to manage the UOW.

i'll have to research bindingsource. with my web apps I pass IEnumerable<Dto> directly to gridviews, repeaters and listcontrols.
Code:
interface IView
{
   IEnumerable<Dto> ListOfDtos { set; }
}

class MyPage : Page, IView
{
   public IEnumerable<Dto> ListOfDtos 
   {
      set 
      { 
         MyListControl.DataSource = value;
         MyListControl.DataBind();
      } 
   }
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
bindingsource is easy

BindingSource bs = new BindingSource;
bs.datasource= somecollectionorsomethingenumerableorlistable;
datagridview1.datasource = bs;

voila that's it.



Christiaan Baes
Belgium

My Blog
 
nice

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top