Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7488155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:45:56+00:00 2026-05-29T14:45:56+00:00

I am using Entity framworke in my project. I am using 3 layer architecture

  • 0

I am using Entity framworke in my project. I am using 3 layer architecture ( Presentation layer(PL), Business logic layer(BLL) and Data Access Layer(BAL)). Entity framework define all entity as well as CRUD operation to BD.

I have encountered one basic problem. Suppose i need to Insert customer in DB. I want to
do is as follow

---------------PL-------------
Customer ObjCustomer=new Customer();

//init object
ObjCustomer.Name="";
--------------
------------

BLL.InsertCustomer(ObjCustomer)

------------------------------------------------

-------------------BLL---------------

DAL.InsertCustomer(ObjCustomer)

------------------------------------

-------------------DAL---------------

CustomerReporitory.InsertCustomer(ObjCustomer)

------------------------------------

Now problem is that customer is defined in DAL as part of EF. It is not advisable to take DAL ref in PL. I want to pass custom class type like customer as parameter. How to do that. Please me some sample code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T14:45:59+00:00Added an answer on May 29, 2026 at 2:45 pm

    The Customer in your presentation layer shouldn’t be the Customer from your business or data layer. The Customer in your presentation layer should be something similar to a ViewModel, so it should only carry attributes and be declared in the business layer. That is the type of object that should be sent to the business layer for CreateCustomer, which in turn creates a business entity or DAO from it and passes it for persistence.

    Presentation layer

    UserViewModel theUser=new UserViewModel(userNameField,passwordField);
    userController.CreateUser(theUser);
    

    Business layer

    public class UserController
    {
        public void CreateUser(UserViewModel user)
        {
            bool isUserValid=ValidateUser(user);
            if(isUserValid)
            {
                UserEntity theEntity=new UserEntity(user);
                _userRepository.Create(theEntity);
            }
            else
            {
                throw new InvalidUserException("This user isn't valid");
            }
        }
    }
    

    Data layer

    public class UserRepository
    {
        public void Create(UserEntity user)
        {
            /* store user to database or whatever */
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in our current project we are using ADO.NET Entity Framework as data layer for
Last year I developed a data access service for our project using Entity Framework
I'm using Entity Framework for creation of my Data Access Layer and I want
I used Entity Framework 4.0 for creating my Data Access Layer. Then I found
I'm using Entity Framework in my project, and I have the problem that, once
I have a SOA application. 1. data layer: Entity Framework 2. Service layer: WCF
I have a ASP.net (C#) project that is using a three layer architecture. I
I am using Entity Framework 4 in my project. One basic requirement is to
I'm using Entity Framework 4 in my project. The Framework has created its own
I am using a layered architecture with the Entity Framework as my datalayer with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.