Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 }));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement