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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:56:41+00:00 2026-06-04T08:56:41+00:00

I am using PetaPoco Micro-ORM with my ASP.NET 4.0 project. PetaPoco T4 template (Database.tt)

  • 0

I am using PetaPoco Micro-ORM with my ASP.NET 4.0 project.

PetaPoco T4 template (Database.tt) generated a file Database.cs. I want to change the name and location of this auto-generated file containing mappings to the database tables. I therefore, copied this file to the APP_DATA folder of my solution explorer and renamed it to EmployeePOCO.cs.

The problem is when I want to update the model (EmployeePOCO.cs) from the database. Each time I delete the old Database.cs file and re-generate it using Database.tt. Than I copy this new Database.cs file to APP_DATA and rename it to EmployeePOCO.cs.

Is there a way to update existing EmployeePOCO.cs file?

  • 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-04T08:56:42+00:00Added an answer on June 4, 2026 at 8:56 am

    Why don’t you copy the Database.tt along with PetaPoco.Core.ttinclude and PetaPoco.Generator.ttinclude itself in App_Data? That way your Database.cs will be generated there itself in App_Data and you don’t have to copy paste between folders.

    Further change the name of the T4 template itself change it EmployeePoco.tt and you will have it’s corresponding EmployeePoco.cs. Also change the parameter RepoName in Database.tt and change it’s value to EmployeePoco. You should be good to go after that.

    Arguably, a better approach is to add a new class library project to your project solution and add it’s reference to your web project. The class library should contain all this data access code (the PetaPoco.cs and other T4 templates along with other data access classes), not your App_Data folder. You can use repository pattern for PetaPoco.

    Check out this blog post:

    http://programmerdave.com/mvc3-petapoco-repository/

    You can customize this class according to your project but it is a good starting point.

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

Sidebar

Related Questions

I am using PetaPoco on my current project as a micro ORM and i
I am using ASP.NET 4.0 with SQL Server 2008 R2 and PetaPoco ORM. A
I am trying PetaPoco with my Asp.Net Project. How can I use PetaPoco with
Just started a 'real world' project using .NET MVC, Ninject, PetaPoco and plan to
I am using PetaPoco Micro-ORM with C# 4.0. The code below retrieves a single
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
I'm using PetaPoco T4 Template (http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx), It always converting table names, for example it
I'm using the PetaPoco mini-ORM, which in my implementation runs stored procedures and maps
Using ASP.NET MVC there are situations (such as form submission) that may require a

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.