-
-
Save Hinidu/d0e60d4e1638906dde49 to your computer and use it in GitHub Desktop.
Insight.Database issue 197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Insight.Database; | |
using Npgsql; | |
namespace Insight | |
{ | |
public interface IRepository | |
{ | |
[Sql("SELECT a + b FROM (SELECT :a AS a, :b AS b) AS t")] | |
int Sum(IBar bar); | |
} | |
public interface IFoo | |
{ | |
int A { get; set; } | |
} | |
public interface IBar : IFoo | |
{ | |
int B { get; set; } | |
} | |
public class Bar : IBar | |
{ | |
public int A { get; set; } | |
public int B { get; set; } | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
const string connectionString = "MY_CONNECTION_STRING"; | |
var connection = new NpgsqlConnection(connectionString).As<IRepository>(); | |
Console.WriteLine(connection.Sum(new Bar { A = 42, B = 13 })); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Insight.Database; | |
using Npgsql; | |
namespace Insight | |
{ | |
public interface IRepository | |
{ | |
[Sql("SELECT a + b + c FROM (SELECT :a AS a, :b AS b, :c AS c) AS t")] | |
int Sum(int c, IBar bar); | |
} | |
public interface IFoo | |
{ | |
} | |
public interface IBar : IFoo | |
{ | |
int A { get; set; } | |
int B { get; set; } | |
} | |
public class Bar : IBar | |
{ | |
public int A { get; set; } | |
public int B { get; set; } | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
const string connectionString = "MY_CONNECTION_STRING"; | |
var connection = new NpgsqlConnection(connectionString).As<IRepository>(); | |
Console.WriteLine(connection.Sum(10, new Bar { A = 42, B = 13 })); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment