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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:58:10+00:00 2026-05-27T14:58:10+00:00

can anybody provide a link for creating a viewmodel for the edmx designer class

  • 0

can anybody provide a link for creating a viewmodel for the edmx designer class

suppose my edmx file is named School.edmx and it has school.Designer.cs class.
In the designer class i have the folowing entity object

[EdmEntityTypeAttribute(NamespaceName="teamworkModel", Name="User")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class User : EntityObject
{

    #region Primitive Properties

    [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
    [DataMemberAttribute()]
    public global::System.Int32 User_Pk
    {
        get
        {
            return _User_Pk;
        }
        set
        {
            if (_User_Pk != value)
            {
                OnUser_PkChanging(value);
                ReportPropertyChanging("User_Pk");
                _User_Pk = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("User_Pk");
                OnUser_PkChanged();
            }
        }
    }
    private global::System.Int32 _User_Pk;
    partial void OnUser_PkChanging(global::System.Int32 value);
    partial void OnUser_PkChanged();


    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
    [DataMemberAttribute()]
    [Required(ErrorMessage="Please enter your name")]
    [StringLength(20,ErrorMessage="Name cannot exceed 20 characters")]
    [RegularExpression(@"^([a-zA-Z0-9 \.\&\'\-]+)$", ErrorMessage = "Invalid name")]
    public global::System.String User_Name
    {
        get
        {
            return _User_Name;
        }
        set
        {
            OnUser_NameChanging(value);
            ReportPropertyChanging("User_Name");
            _User_Name = StructuralObject.SetValidValue(value, false);
            ReportPropertyChanged("User_Name");
            OnUser_NameChanged();
        }
    }
    private global::System.String _User_Name;
    partial void OnUser_NameChanging(global::System.String value);
    partial void OnUser_NameChanged();


    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
    [DataMemberAttribute()]
    [Email(ErrorMessage="Invalid email address")]
    [Required(ErrorMessage="Please enter email address")]
    public global::System.String User_Mail_Id
    {
        get
        {
            return _User_Mail_Id;
        }
        set
        {
            OnUser_Mail_IdChanging(value);
            ReportPropertyChanging("User_Mail_Id");
            _User_Mail_Id = StructuralObject.SetValidValue(value, false);
            ReportPropertyChanged("User_Mail_Id");
            OnUser_Mail_IdChanged();
        }
    }
    private global::System.String _User_Mail_Id;
    partial void OnUser_Mail_IdChanging(global::System.String value);
    partial void OnUser_Mail_IdChanged();


    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
    [DataMemberAttribute()]
    [Required(ErrorMessage="Please enter password")]
    [StringLength(20,ErrorMessage="Password cannot exceed 20 characters")]
    [RegularExpression(@"^([a-zA-Z0-9 \.\&\'\-]+)$", ErrorMessage = "Invalid password")]
    public global::System.String User_Password
    {
        get
        {
            return _User_Password;
        }
        set
        {
            OnUser_PasswordChanging(value);
            ReportPropertyChanging("User_Password");
            _User_Password = StructuralObject.SetValidValue(value, false);
            ReportPropertyChanged("User_Password");
            OnUser_PasswordChanged();
        }
    }
    private global::System.String _User_Password;
    partial void OnUser_PasswordChanging(global::System.String value);
    partial void OnUser_PasswordChanged();


    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
    [DataMemberAttribute()]
    public global::System.DateTime User_Creation_Date
    {
        get
        {
            return _User_Creation_Date;
        }
        set
        {
            OnUser_Creation_DateChanging(value);
            ReportPropertyChanging("User_Creation_Date");
            _User_Creation_Date = StructuralObject.SetValidValue(value);
            ReportPropertyChanged("User_Creation_Date");
            OnUser_Creation_DateChanged();
        }
    }
    private global::System.DateTime _User_Creation_Date;
    partial void OnUser_Creation_DateChanging(global::System.DateTime value);
    partial void OnUser_Creation_DateChanged();

I have the following columns in the above entity object (User table)User_PK,User_Name,User_Password,User_Email_ID…..

Please can anyone suggest how to create a viewmodel for the above entity object that contains all the above columns except User_Password and User_Email_ID because i need to use it as strongly typed viewmodel for my view.I also need to use another table in the same viewmodel with selected columns….

i had gone through a lot of documents..i already spent 1 and half day for this
can anybody help..
i know this question is asked repeatedly but i cannt find the right way in doing it…
Thanks

  • 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-27T14:58:11+00:00Added an answer on May 27, 2026 at 2:58 pm

    Edit: Modified to answer comment about extra properties from other Entities

    This may help

    public class UserViewModel
    {
    public int Pk{get;private set;}
    public string Name{get;set;}
    public DateTime CreationDate{get;set;}
    public string ProjectName{get;set;}
    public DateTime ProjectCreated{get;set;}
    }
    

    The ViewModel is a flattened version of you entities.

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

Sidebar

Related Questions

Can anybody provide some instruction on how to setup a war file to show
Hallo. I have problems by setting the Eclipse envirorment, can anybody provide me a
Can anybody provide the steps for creating DataSource in JBoss server(5.0) with Oracle Database..
Reference: link text i cannot understand the following line , can anybody provide me
Can anybody provide some details on <:< operator in scala. I think: if(apple <:<
Anybody can provide code snippet how to implement something like SEO Smart Links does
Can anybody provide a good step by step example on how to save images
Is there anybody who can provide a c# example of how to get past
Can anybody provide some data showing the performance of code output by llvm's JIT,
Can anybody provide a good starting point or example of using Moq and nUnit

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.