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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:46:53+00:00 2026-05-30T18:46:53+00:00

I have a database ‘Sample’ with a table ‘User’ with columns ‘FirstName’, ‘LastName’, ‘Category’.

  • 0

I have a database ‘Sample’ with a table ‘User’ with columns ‘FirstName’, ‘LastName’, ‘Category’. I am using Entity Framework to access them by using ‘ADO.Net Entity Data Model’. Now I am want to auto generate a class ‘Fields’ at runtime with some constants. Eg:

public Class Fields
{
    public const string firstName = "FirstName";
    public const string lastName = "LastName";
    public const string category = "Category";
}

I want to do this so that I can use them as my column name where ever needed. It will be easy to manage and use in the application. This is being used in my colleagues present project also but he don’t have any clue like how it is being done as the project is quite big. Any other suggestion is always welcome for any other suggestion.

  • 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-30T18:46:54+00:00Added an answer on May 30, 2026 at 6:46 pm

    This could be easily accomplished if you spent just a bit of time investigating “T4”, which is built into Visual Studio. Here is a link to a blog post that has most of the information that you could piece together to do what you want pretty easily:

    http://learneveryday.net/dot-net/code-generation-using-t4-templates/

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

Sidebar

Related Questions

I have Database table and I am using SQL Server 2008. The table contins
I have database with users table where i have many columns include passwords and
I have database with many tables. In the first table, I have a field
I have database application, I want to allow the user to restore the deleted
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have quite a few situations where I have database structures similar to: TABLE
I have a database that contains a date and we are using the MaskedEditExtender
I have a database table and one of the fields (not the primary key)
I have database table Inbox(id,accountid,emailfrom,emailsubject,emailbody, recieveddate,attachment, read(bool) i have added it to the form
I have database relation as follows between question table and Hardware detail table .

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.