Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating 3-tier Simple App. Step 2
Message
From
03/04/2007 13:00:29
 
 
To
03/04/2007 12:55:32
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01210974
Message ID:
01211714
Views:
18
Well, whatever works for you is fine Mike. However, IMHO, it makes more sense to have the DataSets separated out into their own area. We have a "Common" namespace too, but we don't put the DataSets there. Just my 2 cents. =0)

~~Bonnie




>Bonnie,
>I have a project that contains common items through my solution, and I make my datasets part of that project. Instead of having my datasets have the namespace of MyCompany.MyApp.Common, I am putting them in MyCompany.MyApp.Common.Datasets.
>
>>Mike,
>>
>>Are you still using VS2003? If so, since you don't have partial classes, you can create a sub-class of your Typed DataSet to add any code without it being overwritten when the Typed DataSet gets regenerated. As far as the namespace goes, it will be whatever the namespace of the project is ... this is how it should be and I don't know why you'd want it to be anything different. Or maybe I misunderstood what you meant?
>>
>>~~Bonnie
>>
>>
>>>Dmitry,
>>>Have your questions been answered?
>>>
>>>1) Yes, that is a typed dataset.
>>>
>>>2) I believe Bonnie creates a new project for all of her datasets (if I understood what she told me correctly). So far most of my applications haven't had many datasets, so I played around with a few ideas of where to put my datasets. I started with putting them in my data class, but then I had to reference my data project from my UI projects. I have since created a project called "Common" and used this namespace for my datasets: MyCompany.MyApp.Common.Datasets.
>>>
>>>I had problems figuring out how to specify a namespace for my ST dataset in VS.NET 2003. If you change them right in the class code, it will revert back to the default if you make a change to the dataset. The dataset should have a Custom Tool Namespace property, and that is where the namespace should be set. I don't know if this is different in 2005.
>>>
>>>>Hi Bonnie,
>>>>
>>>>I copied your original message to me below (from a different thread) just for clarity for of someone else if they want to follow:
>>>>
>>>>I would like to ask you a question on how to incorporate a typed dataset into the example of this 3-tier simple app.
>>>>
>>>>1. In your sample code below you refer to MyDataSet in CustomerBiz class. Would this be a typed dataset of the customer table?
>>>>2. Do you create a separate project for each typed dataset, for each table of your application?
>>>>
>>>>Thank you in advance for any help.
>>>>
>>>>Dmitry
>>>>
>>>>************ This is a copy of another message ***************
>>>>
>>>>So, to start, your form would be similar to this (to get your data when the form first opens):
>>>>
>>>>using MyCompany.MyApp.Business.MyBiz;
>>>>
>>>>namespace MyCompany.MyApp.WinUI.MyUI
>>>>{
>>>>  public class MyForm : MyBaseForm
>>>>  {
>>>>    private long          CustomerKey;
>>>>    private MyDataSet     dsData;
>>>>    private CustomerBiz   oBiz;
>>>>
>>>>    public MyForm(long key)
>>>>    {
>>>>      this.CustomerKey = key;
>>>>      InitializeComponent();
>>>>      this.FillData();
>>>>    }
>>>>
>>>>    public void FillData()
>>>>    {
>>>>      // To simplify, I'm directly calling a Biz class.
>>>>      // In reality, I use a Web Service here instead
>>>>      // which in turn calls the Biz class.
>>>>
>>>>      oBiz = new CustomerBiz();
>>>>      dsData = oBiz.GetCustomer(this.CustomerKey);
>>>>    }
>>>>  }
>>>>}
>>>>
>>>>Now in your MyBiz project, you'd have a Biz class:
>>>>
>>>>using MyCompany.MyApp.DataAccess.MyDataAccess
>>>>
>>>>namespace MyCompany.MyApp.Business.MyBiz
>>>>{
>>>>  public class CustomerBiz
>>>>  {
>>>>    private MyDataSet dsData;
>>>>
>>>>    public MyDataSet GetCustomer(long CustomerKey)
>>>>    {
>>>>      CustomerAccess oDA = new CustomerAccess();
>>>>      this.dsData = oDA.GetCustomer(CustomerKey);
>>>>
>>>>      // if you have other Biz things to do to this customer
>>>>      // do it here before returning the DataSet
>>>>
>>>>      return this.dsData;
>>>>    }
>>>>  }
>>>>}
>>>>
>>>>And, lastly, in your MyDataAccess project, you'd have this class:
>>>>
>>>>namespace MyCompany.MyApp.DataAccess.MyDataAccess
>>>>{
>>>>  public class CustomerAccess
>>>>  {
>>>>    public MyDataSet GetCustomer(long CustomerKey)
>>>>    {
>>>>      // Here's where you'd put all the SqlCommand and DataAdapter stuff
>>>>      // and fill your DataSet.
>>>>
>>>>      return dsData;
>>>>    }
>>>>  }
>>>>}
>>>>
>>>>Now, that's the "simple" version, just to get the concept. Let's take it a step further:
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform