logo
down
shadow

Using a DataSet instead of custom business entities in soa and n-tier architecture


Using a DataSet instead of custom business entities in soa and n-tier architecture

By : bill
Date : January 02 2021, 06:48 AM
To fix the issue you can do If you use Entity Framework, your entity model doesn't need to match your database schema one to one. That should allow you to keep your entity model stable as the database changes.
There are several issues with returning DataSet from a service. Among others, only a .NET client will understand it. There are others, including the fact that it is wasteful of space and usually includes the schema when it is serialized.
code :


Share : facebook icon twitter icon
Implementing Business Logic in 3 Tier Architecture

Implementing Business Logic in 3 Tier Architecture


By : trond
Date : March 29 2020, 07:55 AM
To fix this issue Don't use php for the business logic.
If you're running on a WinTel server with a SQL Server DB, I'd use C# or another language on the .Net framework.
n-tier architecture: best place to store business objects?

n-tier architecture: best place to store business objects?


By : Timothy Mitchell
Date : March 29 2020, 07:55 AM
should help you out Say I have a 3-tier architecture (UI, Business, and Data). Usually, I create a 4th project called "Model" or "Common" to keep my data access objects and each of the other projects would then use this project. , This is what I have in my project.
1.) Application.Infrastructure
code :
[TableMapping("Users")]
public class User : EntityBase
{
    #region Constructor(s)
    public AppUser()
    {
        BookCollection = new BookCollection();
    }
    #endregion

    #region Properties

    #region Default Properties - Direct Field Mapping using DataFieldMappingAttribute

    private System.Int32 _UserId;

    private System.String _FirstName;
    private System.String _LastName;
    private System.String _UserName;
    private System.Boolean _IsActive;

    [DataFieldMapping("UserID")]
    [DataObjectFieldAttribute(true, true, false)]
    [NotNullOrEmpty(Message = "UserID From Users Table Is Required.")]
    public override int Id
    {
        get
        {
            return _UserId;
        }
        set
        {
            _UserId = value;
        }
    }

    [DataFieldMapping("UserName")]
    [Searchable]
    [NotNullOrEmpty(Message = "Username Is Required.")]
    public string UserName
    {
        get
        {
            return _UserName;
        }
        set
        {
            _UserName = value;
        }
    }

    [DataFieldMapping("FirstName")]
    [Searchable]
    public string FirstName
    {
        get
        {
            return _FirstName;
        }
        set
        {
            _FirstName = value;
        }
    }

    [DataFieldMapping("LastName")]
    [Searchable]
    public string LastName
    {
        get
        {
            return _LastName;
        }
        set
        {
            _LastName = value;
        }
    }

    [DataFieldMapping("IsActive")]
    public bool IsActive
    {
        get
        {
            return _IsActive;
        }
        set
        {
            _IsActive = value;
        }
    }

    #region One-To-Many Mappings
    public BookCollection Books { get; set; }

    #endregion

    #region Derived Properties
    public string FullName { get { return this.FirstName + " " + this.LastName; } }

    #endregion

    #endregion

    public override bool Validate()
    {
        bool baseValid = base.Validate();
        bool localValid = Books.Validate();
        return baseValid && localValid;
    }
}
/// <summary>
/// The BookCollection class is designed to work with lists of instances of Book.
/// </summary>
public class BookCollection : EntityCollectionBase<Book>
{
    /// <summary>
    /// Initializes a new instance of the BookCollection class.
    /// </summary>
    public BookCollection()
    {
    }

    /// <summary>
    /// Initializes a new instance of the BookCollection class.
    /// </summary>
    public BookCollection (IList<Book> initialList)
        : base(initialList)
    {
    }
}
N-tier architecture without using dataset (dataset sounds bad for the performance)

N-tier architecture without using dataset (dataset sounds bad for the performance)


By : user2454132
Date : March 29 2020, 07:55 AM
help you fix your problem Most of what's been said is solid advice. I would agree that if you're looking into investing the time to build an N-Tier application, you should consider looking into an ORM solution. If you're building on .NET technologies, EF4 is a very good approach to building your DAL.
There is definite confusion on your understanding of what your DAL/BLL should be returning. DataSets are a bit antiquated now in .NET 3 and 4, though not uncommon. You should read up on the Repository design pattern when building your DAL. Depending on the implementation, your repository will typically return a generic List or IQueryable. IQueryable is my preference, however, it's been argued that it blurs the lines between your BLL and DAL.
code :
[DataContract]
public sealed class UserSummary : IDto
{
[DataMember]
public String FirstName { get; private set; }

[DataMember]
public String LastName { get; private set; }

[DataMember]
public UserProfile Profile { get; private set; }

public UserSummary(String firstName, String lastName, UserProfile profile)
{
    FirstName = firstName;
    LastName = lastName;
    Profile = profile;
}

}
Business Layer in 3 tier Architecture

Business Layer in 3 tier Architecture


By : user3561213
Date : March 29 2020, 07:55 AM
Does that help a 3 tier Architecture is composed by 3 Main Layers
PL Presentation Layer BLL Business Logic Layer DAL Data Access Layer
code :
namespace Company.BLL
{
  // let's create an interface so it's easy to create other BLL's if needed
  public interface ICompanyBLL
  {
      public int Save(Order order, UserPermissions user);
  }

  public class Orders : ICompanyBLL
  {
    // Dependency Injection so you can use any kind of BLL 
    //   based in a workflow for example
    private Company.DAL db;
    public Orders(Company.DAL dalObject)
    {
      this.db = dalObject;
    }

    // As this is a Business Layer, here is where you check for user rights 
    //   to perform actions before you access the DAL
    public int Save(Order order, UserPermissions user)
    {
        if(user.HasPermissionSaveOrders)
            return db.Orders.Save(order);
        else
            return -1;
    }
  }
}
public class MainController : Controller
{
    public IServiceRepository service;

    protected override void Initialize(System.Web.Routing.RequestContext requestContext)
    {
        ...

        if (thisUser.currentConnection.ws_version == 6)
            // Use old ASMX Web Service
            service = new WebServiceRepository6(url, ws_usr, ws_pwd);

        else if (thisUser.currentConnection.ws_version == 7)
            // Use the brand new WCF Service
            service = new WebServiceRepository7(url, ws_usr, ws_pwd);

        ...

    }
}
3-tier Architecture business logic

3-tier Architecture business logic


By : Nevisu
Date : October 02 2020, 07:00 PM
To fix the issue you can do This question can go more to the developer's personal point of view. Here's some techniques I use to organize my code. Just try to see if they fit your scenario and change them to your need.
Move some logic to your entities.Example: An entity should be able to know if is in a good state.
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk