Object Orientated Design, Master Pages, LINQ to SQL

I need to know about design patterns. Has anyone used any design patterns in their application(s)/project(s)? Which one’s the most commonly used?

A good design pattern makes it easier to design, write and maintain software. It is only a structured way of programming that leads to a robust architecture.

The benefits include:

  1. Adaptable software; e.g. the user interface or database provider can be easily changed.
  2. Maintainable software; the separation of concerns means you know where to make changes.
  3. Better communications; e.g. with other developers, managers and clients.

Most design patterns split an application in to layers or tiers, e.g. presentation, business and data access tiers. These correspond with how we normally think of software interacting with users, applying business logic and storing data.

Different design patterns suit different types of application, e.g. MVC is popular for web applications and MVVM works well for WPF applications.

Here is our tutorial on OOP in C#.

Any ideas about how to do the best object oriented design for a project. Any tips would be highly appreciated.

First become really familiar with the principles of object orientation.  Then when you start the design for a project think about the problem domain.  For example, with a college admin program this could include students, courses, lecturers.
The design stages go something like this:

  1. Isolate the key entities in the problem domain
  2. Extract out all common elements from these entities as base classes
  3. Specify the members (properties , methods, fields etc.) for these classes
  4. Create the base classes
  5. Inherit the derived classes from the base classes

You then (in theory!) have a class hierarchy that models the problem domain.
There are lots of tools to help with this design process, e.g. UML provides a notation for creating class diagrams.

Here is our tutorial on OOP in C#.

Can someone help me.  I had have many sleepless night on this.
I have a project with a master page and a theme.  My header and footer are in the master page. I can changed the theme in content page.

But the problem is the master page cannot have a theme applied to it. Can any one have a work around? Thanks in advance.

Since a theme cannot be applied to a master page, you could:

  1. Have several master pages with different layouts
  2. Switch the content page’s master file at runtime.
protected void Page_PreInit(object sender, EventArgs e)
Page.MasterPageFile = “Site.Master2”;

Take a look at our tutorial in web development in C#.

An XML problem.  I am using XML as a database.
following XML:-

<?xml version=”1.0″ encoding=”utf-8″?>
<Upload xmlns=”http://tempuri.org/XMLShm_UploadImages.xsd”>
<Category ID=”8″>
<Imagepath ImgPath=”Hydrangeas.jpg”>
<Imagepath ImgPath=”Desert1.jpg”>

I want to bind it to repeater.  When I am using dataset to read this XML
then there are three tables created in the dataset.  I only want to use a datatable.

Can any one tell me the best way to put this XML into datatable?

To put you XML in a datatable try using the datatable’s ReadXmlSchema() and ReadXml() method. The XML schema is interpreted according to the XSD standard. You can use this to define the structure of the datatable.

DataTable newTable = new DataTable();

This is our tutorial on ADO.Net data access in C#.

I need any LINQ and Entity framework materials.

Here is our tutorial on data access in C#.


I am working on web application using LINQ to access a database. Can anybody tell what are advantages of using LINQ over directly using stored procedures?

One advantage of using LINQ is that you create your database queries directly in VB or C#. This creates simpler code that avoids using ADO.Net objects (or using other data access methods).

To access a SQL Server database you can use LINQ to SQL. This allows you to drag tables, views and stored procedures to a design surface. LINQ to SQL automatically creates classes and collections. You can then run LINQ queries against the generated collections.

LINQ to SQL is a powerfull ORM system. For more custom applications, this may obscure the way you work with data. In this case, it is best to call stored procedures directly.

Here is our tutorial on data access in C#.


Scroll to Top
Share via
Copy link