简体   繁体   中英

Setting a classes accessors correctly across a business logic layer?

I have several classes within my business logic layer (some examples);

Atomic.Core.BLL.Client Atomic.Core.BLL.Airport Atomic.Core.BLL.Airline

When setting up the accessors on each class, I want to sometimes refer to objects within the BLL (as they are interlinked), but I want to do it efficiently and moreover with best practice.

I want to do something like this:

using System;
using System.Data;
//removed for brevity

namespace Atomic.Core.BLL.Airport
{
    public class Airport
    {
        private int airport_id = 0;
        public int AirportId
        {
            get { return airport_id; }
            set { airport_id = value; }
        }
        private Airline airline = null;
        public Airline Airline
        {
            get { return airline; }
            set { airline = value; }
        }
    }
}

Visual Studio says that my AirlineObject is a namespace being used as a type, which I totally understand, so can I add Airline to the Using list and shorthand it? How do I do that? using Atomic.Core.BLL.Airline as Airline ? I can't remember! Also, am I missing the point here and should I re-think what I am trying to do?

Help (as always) appreciated.

使用Airline = Atomic.Core.BLL.Airline;

I wouldn't have all BLL classes in their own namespace. Dump them all into Atomic.Core.BLL, or a subsection - Atomic.Core.BLL.AiportLogic - if you need to be more specific.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM