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

  • Home
  • SEARCH
  • 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 9117525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:57+00:00 2026-06-17T04:54:57+00:00

I have a solution with existing data access layer(class library) with models in it.

  • 0

I have a solution with existing data access layer(class library) with models in it. I have web forms application which calls this library to do crud operations on db using stored procs. If I want to convert this webform application into an MVC 3 application what should be my approach for migration. I don’t want to use entity framework and would like to continue using my dataaccess layer for models and operations on model as the same library is being used by my webservices project. Any pointers.

  • 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-06-17T04:54:58+00:00Added an answer on June 17, 2026 at 4:54 am

    Sure View Models are meant for moving data to/from views to your business/data layer. If you already have models defined in your data layer, then you can either have your view model inherit your data model or have the view consume it directly.

    I’d recommend inheriting and then using new properties in your view model to set the underlying (inherited) properties. That way you can add validation attributes to your new properties and enforce validation at the client & server before setting the inherited properties and updating the database.

    As an example, if your data layer has:

    public class Person
    {
        public string Name {get; set;}
        public string Email {get; set;}
    }
    

    Then in your View Model you can use:

    public class VPerson : Person
    {
        [Required(ErrorMessage = "Name is required.")]
        [StringLength(50, ErrorMessage = "Name cannot be longer than 50 characters.")]
        public string VName { get; set; }
    
        [Required(ErrorMessage = "Email is required.")]
        [RegularExpression(Settings.EmailRegex, ErrorMessage = "Email Address is not valid.")]
        [StringLength(50, ErrorMessage = "Email cannot be longer than 50 characters.")]
        public string VEmail { get; set; }
    
        public void SavePerson()
        {
            Name = VName;
            Email = VEmail;
            // update the DB
        }
    }
    

    Properties that don’t need validation (i.e. DropDown lists) you can use directly.

    You don’t actually need to inherit, and could just call your data layer in SavePerson.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application solution existing under Visual Studio 2010. Part of this
I have Solution with web site MyProject. I need publish this web site. In
I have a solution which contains six projects. Four of the projects are class
Im currently researching how to port the Data Access Layer of an existing .NET
I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is
This is kind of a curiosity question. I do have an existing solution, but
I have an existing business application written in Excel which the client would like
If I have an existing solution containing multiple c# projects, are there any static
Currently I have solution A that contains a domain layer base and solution B
I have a Solution called Framework which is a C# assembly for my business

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.