PetaPOCO T4 Template, generate multiple files (one for each table)
up vote
2
down vote
favorite
I wanted to try PetaPOCO and I was reading a tutorial on how to use their T4 template, and from what I understood it will generate one file "Database.cs" which will include all classes/tables.
Is there a way to generate one file per class/table instead (ex: Employee.cs, Company.cs, Job.cs..etc?
t4 petapoco
add a comment |
up vote
2
down vote
favorite
I wanted to try PetaPOCO and I was reading a tutorial on how to use their T4 template, and from what I understood it will generate one file "Database.cs" which will include all classes/tables.
Is there a way to generate one file per class/table instead (ex: Employee.cs, Company.cs, Job.cs..etc?
t4 petapoco
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I wanted to try PetaPOCO and I was reading a tutorial on how to use their T4 template, and from what I understood it will generate one file "Database.cs" which will include all classes/tables.
Is there a way to generate one file per class/table instead (ex: Employee.cs, Company.cs, Job.cs..etc?
t4 petapoco
I wanted to try PetaPOCO and I was reading a tutorial on how to use their T4 template, and from what I understood it will generate one file "Database.cs" which will include all classes/tables.
Is there a way to generate one file per class/table instead (ex: Employee.cs, Company.cs, Job.cs..etc?
t4 petapoco
t4 petapoco
asked Nov 13 at 10:45
SA45CAL
114
114
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16
add a comment |
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279277%2fpetapoco-t4-template-generate-multiple-files-one-for-each-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can. This is a nice feature to add, but it implies a big set of modification with the t4 template provided... plus you will have to deal with configuration and namespaces..... it makes me wonder if anyone already did this???? Like the nugget package using repository pattern and petapoco...
– Minus
Nov 14 at 1:01
@Minus I never used T4 before so I'm not sure where to start. I tried searching but didn't find anything conclusive. To me it makes more sense to use one file per table as opposed to use one large file for the entire database, especially when multiple developers are involved. Thanks anyways.
– SA45CAL
Nov 18 at 5:40
You also can do what you want, without any T4 files. You just decorate your POCO with Attributes (TableName, PrimaryKey, Column, ...). This is manual, but it works.
– Minus
Nov 20 at 14:10
@Minus True, but that defeats the purpose since the point of using templates is to save time.
– SA45CAL
Nov 21 at 4:16