T4 to create stored procedure code using poco.Has anyone done this?

Moving towards poco and I wonder if anyone wrote a template for generating stored procedure code when using poco in EF4?

I do not mean the sql code, I mean the actual C # code that speaks to the Sql server.

That would be fantastic !!!

any suggestions or links would be great

+4
source share
1 answer

Try EF SqlQuery Database

public class SpecificationAdHocQuery<T> : ISpecificationAdHocQuery<T> where T : class { protected string Sql; protected object[] Parameters; protected SpecificationAdHocQuery() { } public SpecificationAdHocQuery(string sql, params object[] parameters) { Sql = sql; Parameters = parameters; } public T ExecuteAdHocQueryReturnsEntity(Database database) { return database == null ? default(T) : database.SqlQuery<T>(Sql, Parameters).FirstOrDefault(); } public IQueryable<T> ExecuteAdHocQueryReturnsEntities(Database database) { return database == null ? default(IQueryable<T>) : database.SqlQuery<T>(Sql, Parameters).AsQueryable(); } 
0
source

Source: https://habr.com/ru/post/1332624/


All Articles