Sep 19, 2013

Quickly generating POCO classes from DB table

You add new table to database.
You want to quickly create appropriate POCO class uses solely for ORM (NPOCO) or any of your own.
How?

http://stackoverflow.com/questions/10136520/how-to-automatically-create-model-from-database-using-petapoco-library

Create console app.
Add app.config
Add connection string

Install NuGet package "Peta Poco" (Topten Software, ver 5.0.1 but any will do).

I'm not sure do you need to rebuild.

Peta poco should generate Models / Generated / Database.tt
Right click Database.tt and "Run custom toll":
Voila !
Under Database.tt you will find Database.cs. There you'll find all your Poco classes.

Watch it  !

Carefully check what is generated. This template from Peta Poco is not perfected but it should do job for most common scenarios.

Sep 17, 2013

Visual Studio - tracking multiple web projects in single instance

I have 2 webapi's  in one solution.
They communicate with eachother.
Question is how to debug both of them in same time.
Select solution, not project!
Go to properties of solution and select Startup project.
Choose multiple projects as startup.
Now VS will start multiple projects in standalone W3WP processes and all debug breakpoints will be loaded for all projects.