Click here to Skip to main content
15,913,709 members
Home / Discussions / C#
   

C#

 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 7:22
N a v a n e e t h24-May-08 7:22 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 8:49
Colin Angus Mackay24-May-08 8:49 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 9:02
N a v a n e e t h24-May-08 9:02 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 9:31
Colin Angus Mackay24-May-08 9:31 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 18:13
N a v a n e e t h24-May-08 18:13 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 22:57
Colin Angus Mackay24-May-08 22:57 
GeneralRe: Mocking objects Pin
N a v a n e e t h25-May-08 7:03
N a v a n e e t h25-May-08 7:03 
GeneralRe: Mocking objects Pin
N a v a n e e t h25-May-08 18:48
N a v a n e e t h25-May-08 18:48 
I have written the following DTO.
class Product
{
   internal Product(ProductItem item)
   {
      this.Name = item.Name;
   }
   
   public string Name
   {
       get;set;
   }

   public static Product FromId(int productId)
   {
      ProductDAL data = new ProductDAL();
      ProductItem item = data.GetProductFromId(productId);
      return ProductFactory.CreateProduct(item);
   }

    public void Save()
    {
       ProductDAL data = new ProductDAL();
       ProductItem item = new ProductItem(this.Name);
       data.SaveDetails(item);
    }

}

static class ProductFactory
{
   public static CreateProduct(ProductItem item)
   {
      Product product = new Product(item);
      return product;
   }
}

// DTO class
class ProductItem
{
    public ProductItem(string name)
    {
       this.Name = name;
    }

    public string Name
    {
       get;set;
    }
}
Here ProductItem is the DTO class and it contains only getters and setters. This is mutable. Is this correct ? Do you used to write methods in the DTO class ?

Thanks for the replies.

All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

QuestionFormatting a number Pin
N.Surendra Prasad23-May-08 20:43
N.Surendra Prasad23-May-08 20:43 
GeneralRe: Formatting a number Pin
Krazy Programmer23-May-08 20:45
Krazy Programmer23-May-08 20:45 
AnswerRe: Formatting a number Pin
DaveyM6923-May-08 22:19
professionalDaveyM6923-May-08 22:19 
GeneralRe: Formatting a number Pin
N.Surendra Prasad25-May-08 17:29
N.Surendra Prasad25-May-08 17:29 
GeneralRe: Formatting a number Pin
DaveyM6925-May-08 22:26
professionalDaveyM6925-May-08 22:26 
GeneralRe: Formatting a number Pin
DaveyM6925-May-08 23:02
professionalDaveyM6925-May-08 23:02 
QuestionC# noob needs help with udp & in general Pin
DrWigglechin23-May-08 19:29
DrWigglechin23-May-08 19:29 
AnswerRe: C# noob needs help with udp & in general Pin
leppie24-May-08 8:39
leppie24-May-08 8:39 
QuestionHow to update exe file after install application Pin
cocoonwls23-May-08 16:32
cocoonwls23-May-08 16:32 
AnswerRe: How to update exe file after install application Pin
Ravi Bhavnani23-May-08 16:59
professionalRavi Bhavnani23-May-08 16:59 
GeneralRe: How to update exe file after install application Pin
cocoonwls23-May-08 18:15
cocoonwls23-May-08 18:15 
GeneralRe: How to update exe file after install application Pin
Ravi Bhavnani23-May-08 18:19
professionalRavi Bhavnani23-May-08 18:19 
QuestionAbout "Cell Change" event in Excel Pin
Mushtaque Nizamani23-May-08 16:32
Mushtaque Nizamani23-May-08 16:32 
QuestionWindows file metadata Pin
asgardh23-May-08 15:13
asgardh23-May-08 15:13 
QuestionAbstract Classes and Interfaces Pin
Jacob Dixon23-May-08 13:31
Jacob Dixon23-May-08 13:31 
AnswerRe: Abstract Classes and Interfaces Pin
Anthony Mushrow23-May-08 14:00
professionalAnthony Mushrow23-May-08 14:00 
GeneralRe: Abstract Classes and Interfaces Pin
Jacob Dixon23-May-08 14:22
Jacob Dixon23-May-08 14:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.