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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:25:59+00:00 2026-05-30T16:25:59+00:00

I’m using a DB first approach, using Entity Framework and I’ve just read this

  • 0

I’m using a DB first approach, using Entity Framework and I’ve just read this article about POCO In EF. Now: How can I generate the POCO templates directly from the database?

namespace My.Domain
{
    public class Entity
    {
        public virtual long EntityId { get; set; }
        public virtual string Example { get; set; }
        public virtual long NextId { get; set; }
        public virtual bool Lame { get; set; }
    }
}

In fact I would like it very much to being able to generate the same stuff I generate manually, in just one step:

  • Add the ObjectSet for each table to the ObjectContext, each with it’s field, property getter and creation.
  • Create POCO entities, preferrably in another project, with all the property mappings including relationships, with properties marked as virtual to enable proxying, and obviously in a namespace of my choice.

Is there a “simple” way to accomplish this using T4 templates, or is there some other tool available to do just this? Perhaps some kind of Custom Tool instead of the one that comes with EF, but that is POCO-oriented?

  • 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-30T16:26:00+00:00Added an answer on May 30, 2026 at 4:26 pm

    As long as you are using EF 4.1, then getting POCO objects generated is “built-in”. Please refer to this article:

    http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-model-amp-database-first-walkthrough.aspx

    which, was just a piggy back to the older, more long-winded way found in

    http://blogs.msdn.com/b/adonet/archive/2010/01/25/walkthrough-poco-template-for-the-entity-framework.aspx

    The first method is more of the suggested method now, but I figured I would also give you the older one anyway 🙂

    Hopefully, this fits your needs :). I am not sure about creating it in your specified namespace and project. That sounds more like Code First (which you MIGHT be able to do and wire perfectly to the database?), but you might be able to bend the generation item to your whim. This should be a push in the right direction, though

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.