简体   繁体   中英

ServiceStack get ORMLite to use T4

I am evaluating T4 for ORMLite. Regardless of a couple glitches I made it working. When I point the web.config to Northwind in MSSQL and run that from my SS web project the OrmLite.SP.cs automatically generates the following:

public class OrmLiteSPStatement
{
 ....
        try
        {
            reader = command.ExecuteReader();
#pragma warning disable 618
            return reader.GetFirstColumn<T>();
#pragma warning restore 618
        }
        finally ...

        try
        {
            reader = command.ExecuteReader();
#pragma warning disable 618
            return reader.GetScalar<T>();
#pragma warning restore 618
        }
        finally ...

        try
        {
            reader = command.ExecuteReader();
#pragma warning disable 618
            return reader.GetFirstColumn<T>();
#pragma warning restore 618
        }
        finally ...

        try
        {
            reader = command.ExecuteReader();
#pragma warning disable 618
            return reader.GetFirstColumnDistinct<T>();
#pragma warning restore 618
        }
        finally ...

They are all from the OrmLite.SP.cs auto-gen code in the OrmLiteSPStatement class...

   Error    1   No overload for method 'GetFirstColumn' takes 0 arguments 
   Error    2   No overload for method 'GetScalar' takes 0 arguments 
   Error    3   No overload for method 'GetFirstColumn' takes 0 arguments 
   Error    4   No overload for method 'GetFirstColumnDistinct' takes 0 arguments

When I move my mouse over to inspect the error, visual studio says:

Cannot access internal method 'GetFirstColumn' here

How do I fix it?

I am running VS2012, .Net 4.0, ServiceStack 3.9.38.0, SQL2008R2

These T4 templates are still using the deprecated methods that were made internal last week.

Raise an issue with the OrmLite project (or pull-request) so we can keep track of the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM