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 7446271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:16:33+00:00 2026-05-29T12:16:33+00:00

I have built a data driven model by dragging my tables onto the empty

  • 0

I have built a data driven model by dragging my tables onto the empty designer of an edml. I know that I can establish a datacontext around my model, and that I can access each table as though it were a class, but where is the code for each of these models?

I ask because I want to add validation to the setters of each property on the class itself.

  • 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-29T12:16:34+00:00Added an answer on May 29, 2026 at 12:16 pm

    Look for a .dbml file on the root level of your project. Under that file, you will see a file called <someDB>.designer.cs.

    However, (and you’ll see this at the top of the designer file as well), you don’t really want to make any changes to the classes in this file.

    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    

    If you want to make additions, you should look into creating Partial classes that extend the functionality of the generated classes.

    Here is a sample partial class that I created to handle my validations:

     namespace ETL_Framework_UI
    {
    [MetadataType(typeof(DataObjectMD))]
    public partial class DATA_OBJECT:IValidatableObject
    {
    
        public class DataObjectMD
        {
            [Required(ErrorMessage="The object name is required")]
            [StringLength(50, ErrorMessage = "Name cannot exceed 50 characters")]
            public string OBJECT_NAME { get; set; }
    
        }
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            ETLDbDataContext db = new ETLDbDataContext();
            var field = new[] { "OBJECT_NAME" };
            var param = db.DATA_OBJECTs.SingleOrDefault(r => r.OBJECT_NAME == OBJECT_NAME && r.OBJECT_ID != OBJECT_ID);
            if (param != null)
            {
                yield return new ValidationResult("Object name is already in use. ", field);
    }
    

    NOTE Your partial class must be defined in the same namespace that you see at the top of your designer.cs file.

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

Sidebar

Related Questions

I have a Windows Form application built on a data model and a Windows
So, I have a nice domain model built. Repositories handle the data access and
I have a number data-driven web based applications that serve both internal and public
I have a website built using Asp.net and LinqToSql for Data Access. In a
I have a web-based system built with user login data based on session variables.
I have to build an HTML table that shows data for users versus pages
I have built an MSI that I would like to deploy, and update frequently.
We have a suite of converters that take complex data and transform it. Mostly
I have to build many data-driven web application for various clients. The aim is
I have a local server running on port 6868. Technically it's node.js-driven micro-site built

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.