1+ #nullable enable
2+ namespace Dapper . AOT // interceptors must be in a known namespace
3+ {
4+ file static class DapperGeneratedInterceptors
5+ {
6+ [ global ::System . Runtime . CompilerServices . InterceptsLocationAttribute ( "Interceptors\\ BatchSize.input.cs" , 13 , 20 ) ]
7+ internal static int Execute0 ( this global ::System . Data . IDbConnection cnn , string sql , object ? param , global ::System . Data . IDbTransaction ? transaction , int ? commandTimeout , global ::System . Data . CommandType ? commandType )
8+ {
9+ // Execute, HasParameters, Text, KnownParameters
10+ // takes parameter: global::<anonymous type: int id, string bar>[]
11+ // parameter map: bar id
12+ global ::System . Diagnostics . Debug . Assert ( ! string . IsNullOrWhiteSpace ( sql ) ) ;
13+ global ::System . Diagnostics . Debug . Assert ( ( commandType ?? global ::Dapper . DapperAotExtensions . GetCommandType ( sql ) ) == global ::System . Data . CommandType . Text ) ;
14+ global ::System . Diagnostics . Debug . Assert ( param is not null ) ;
15+
16+ return global ::Dapper . DapperAotExtensions . Command ( cnn , transaction , sql , global ::System . Data . CommandType . Text , commandTimeout . GetValueOrDefault ( ) , CommandFactory0 . Instance ) . Execute ( ( object ? [ ] ) param ! , batchSize : 10 ) ;
17+
18+ }
19+
20+ [ global ::System . Runtime . CompilerServices . InterceptsLocationAttribute ( "Interceptors\\ BatchSize.input.cs" , 21 , 20 ) ]
21+ internal static int Execute1 ( this global ::System . Data . IDbConnection cnn , string sql , object ? param , global ::System . Data . IDbTransaction ? transaction , int ? commandTimeout , global ::System . Data . CommandType ? commandType )
22+ {
23+ // Execute, HasParameters, Text, KnownParameters
24+ // takes parameter: global::<anonymous type: int id, string bar>[]
25+ // parameter map: bar id
26+ global ::System . Diagnostics . Debug . Assert ( ! string . IsNullOrWhiteSpace ( sql ) ) ;
27+ global ::System . Diagnostics . Debug . Assert ( ( commandType ?? global ::Dapper . DapperAotExtensions . GetCommandType ( sql ) ) == global ::System . Data . CommandType . Text ) ;
28+ global ::System . Diagnostics . Debug . Assert ( param is not null ) ;
29+
30+ return global ::Dapper . DapperAotExtensions . Command ( cnn , transaction , sql , global ::System . Data . CommandType . Text , commandTimeout . GetValueOrDefault ( ) , CommandFactory1 . Instance ) . Execute ( ( object ? [ ] ) param ! ) ;
31+
32+ }
33+
34+ private class CommonCommandFactory < T > : global ::Dapper . CommandFactory < T >
35+ {
36+ public override global ::System . Data . Common . DbCommand GetCommand ( global ::System . Data . Common . DbConnection connection , string sql , global ::System . Data . CommandType commandType , T args )
37+ {
38+ var cmd = base . GetCommand ( connection , sql , commandType , args ) ;
39+ // apply special per-provider command initialization logic for OracleCommand
40+ if ( cmd is global ::Oracle . ManagedDataAccess . Client . OracleCommand cmd0 )
41+ {
42+ cmd0 . BindByName = true ;
43+ cmd0 . InitialLONGFetchSize = - 1 ;
44+
45+ }
46+ return cmd ;
47+ }
48+
49+ }
50+
51+ private static readonly CommonCommandFactory < object ? > DefaultCommandFactory = new ( ) ;
52+
53+ private sealed class CommandFactory0 : CommonCommandFactory < object ? > // <anonymous type: int id, string bar>
54+ {
55+ internal static readonly CommandFactory0 Instance = new ( ) ;
56+ public override void AddParameters ( in global ::Dapper . UnifiedCommand cmd , object ? args )
57+ {
58+ var typed = Cast ( args , static ( ) => new { id = default ( int ) , bar = default ( string ) ! } ) ; // expected shape
59+ var ps = cmd . Parameters ;
60+ global ::System . Data . Common . DbParameter p ;
61+ p = cmd . CreateParameter ( ) ;
62+ p . ParameterName = "id" ;
63+ p . DbType = global ::System . Data . DbType . Int32 ;
64+ p . Direction = global ::System . Data . ParameterDirection . Input ;
65+ p . Value = AsValue ( typed . id ) ;
66+ ps . Add ( p ) ;
67+
68+ p = cmd . CreateParameter ( ) ;
69+ p . ParameterName = "bar" ;
70+ p . DbType = global ::System . Data . DbType . String ;
71+ p . Size = - 1 ;
72+ p . Direction = global ::System . Data . ParameterDirection . Input ;
73+ p . Value = AsValue ( typed . bar ) ;
74+ ps . Add ( p ) ;
75+
76+ }
77+ public override void UpdateParameters ( in global ::Dapper . UnifiedCommand cmd , object ? args )
78+ {
79+ var typed = Cast ( args , static ( ) => new { id = default ( int ) , bar = default ( string ) ! } ) ; // expected shape
80+ var ps = cmd . Parameters ;
81+ ps [ 0 ] . Value = AsValue ( typed . id ) ;
82+ ps [ 1 ] . Value = AsValue ( typed . bar ) ;
83+
84+ }
85+ public override bool CanPrepare => true ;
86+
87+ }
88+
89+ private sealed class CommandFactory1 : CommonCommandFactory < object ? > // <anonymous type: int id, string bar>
90+ {
91+ internal static readonly CommandFactory1 Instance = new ( ) ;
92+ public override void AddParameters ( in global ::Dapper . UnifiedCommand cmd , object ? args )
93+ {
94+ var typed = Cast ( args , static ( ) => new { id = default ( int ) , bar = default ( string ) ! } ) ; // expected shape
95+ var ps = cmd . Parameters ;
96+ global ::System . Data . Common . DbParameter p ;
97+ p = cmd . CreateParameter ( ) ;
98+ p . ParameterName = "id" ;
99+ p . DbType = global ::System . Data . DbType . Int32 ;
100+ p . Direction = global ::System . Data . ParameterDirection . Input ;
101+ p . Value = AsValue ( typed . id ) ;
102+ ps . Add ( p ) ;
103+
104+ p = cmd . CreateParameter ( ) ;
105+ p . ParameterName = "bar" ;
106+ p . DbType = global ::System . Data . DbType . String ;
107+ p . Size = - 1 ;
108+ p . Direction = global ::System . Data . ParameterDirection . Input ;
109+ p . Value = AsValue ( typed . bar ) ;
110+ ps . Add ( p ) ;
111+
112+ }
113+ public override void UpdateParameters ( in global ::Dapper . UnifiedCommand cmd , object ? args )
114+ {
115+ var typed = Cast ( args , static ( ) => new { id = default ( int ) , bar = default ( string ) ! } ) ; // expected shape
116+ var ps = cmd . Parameters ;
117+ ps [ 0 ] . Value = AsValue ( typed . id ) ;
118+ ps [ 1 ] . Value = AsValue ( typed . bar ) ;
119+
120+ }
121+ public override bool CanPrepare => true ;
122+
123+ }
124+
125+
126+ }
127+ }
128+ namespace System . Runtime . CompilerServices
129+ {
130+ // this type is needed by the compiler to implement interceptors - it doesn't need to
131+ // come from the runtime itself, though
132+
133+ [ global ::System . Diagnostics . Conditional ( "DEBUG" ) ] // not needed post-build, so: evaporate
134+ [ global ::System . AttributeUsage ( global ::System . AttributeTargets . Method , AllowMultiple = true ) ]
135+ sealed file class InterceptsLocationAttribute : global ::System . Attribute
136+ {
137+ public InterceptsLocationAttribute ( string path , int lineNumber , int columnNumber )
138+ {
139+ _ = path ;
140+ _ = lineNumber ;
141+ _ = columnNumber ;
142+ }
143+ }
144+ }
0 commit comments