This file contains hidden or 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 System.ComponentModel; | |
using System.Xml.XPath; | |
using System.Reflection; | |
using System.Linq; | |
using Microsoft.OpenApi.Any; | |
using Newtonsoft.Json.Serialization; | |
using Microsoft.OpenApi.Models; | |
using Microsoft.AspNetCore.Mvc; |
This file contains hidden or 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
# Location where ssh-agent settings are persisted | |
SSH_ENV="$HOME/.ssh/environment" | |
# Start ssh-agent and persist its settings | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
touch $SSH_ENV | |
chmod 600 "${SSH_ENV}" | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null |
This file contains hidden or 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
@if (@X)==(@Y) @end /* JScript comment | |
@echo off | |
setlocal | |
for /f "tokens=2" %%i in ('tasklist /FI "IMAGENAME eq Fork.exe" ^| find /I "Fork.exe"') do set pid=%%i | |
if "%pid%" == "" ( | |
%localappdata%\Fork\Fork.exe | |
) else ( | |
cscript //E:JScript //nologo "%~f0" "%~nx0" "%pid%" | |
) |
This file contains hidden or 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
var db = new MightyOrm(connectionString); | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or 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
var db = new MightyOrm(tableName: "Employee", primaryKey: "EmployeeID"); | |
db.Update(new {EmployeeID = 42, Salary = 100000}); |
This file contains hidden or 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
// use DynamicModel instead of MightyOrm for original Massive code | |
var db = new MightyOrm(connectionString); | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or 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
var db = new MightyOrm<Employee>(connectionString); | |
// the rest of the previous code sample stays exactly the same, | |
// though each employee value will now be strongly typed | |
var smiths = db.Query("SELECT * FROM Employees WHERE FamilyName = @0", "Smith"); | |
foreach (var employee in smiths) | |
{ | |
Console.WriteLine($"ID={employee.ID} GivenName={employee.GivenName}"); | |
} |
This file contains hidden or 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
var db = new MightyOrm(connectionSting); | |
var results = db.ExecuteProcedure("TestSumProc", | |
inParams: new { a = 1, b = 2 }, | |
outParams: new { c = 0 }); | |
// passes! | |
Assert.AreEqual(3, results.c); |
This file contains hidden or 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
var results = db.ExecuteProcedure("TestProc", | |
inParams: new { a = 1, b = 2 }, | |
outParams: new { c = (int?)null }); |
This file contains hidden or 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
// passing a cursor parameter between calls in Mighty | |
var res1 = db.ExecuteWithParams( | |
"begin open :p_rc for select * from emp " + | |
"where deptno = 10; end;", | |
outParams: new { p_rc = new Cursor() }, | |
connection: conn); | |
db.ExecuteProcedure( | |
"cursor_in_out.process_cursor", | |
inParams: new { p_cursor = res1.p_rc }, |
OlderNewer