Yara
Yara

Reputation: 4565

What is the best practice to manage Business Objects?

I am looking for valid architectural solution. For example, in my program exist 'Country' class. This class can be marked with various number of attributes.

[Table(Name="tblCountries")]
[XmlType(Namespace = "bills")]
public class Country
{
    [Column(Name = "idCountry", IsPrimaryKey = true, IsDbGenerated = true)]
    public int IdCountry { get; set; }


    [Column(Name="code")]
    [Required(ErrorMessage = "myMessage")]
    public string Code { get; set; }

    [Column(Name = "title")]
    [Required(ErrorMessage = "myMessage")]
    public string Title { get; set; }
}

So, is it ok when class and fields are marked by attributes from different spheres? Maybe there is more interesting solution?

Upvotes: 0

Views: 169

Answers (1)

Oded
Oded

Reputation: 499002

You can mark a class or member by any number of different valid attributes you want to.

This just adds meta data to the decorated members - the data will be used by different tools, but shouldn't interfere with your objects.

Upvotes: 1

Related Questions