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 System.Collections.Generic; | |
using System.Linq; | |
using Realms; | |
using StubbsTest.Models; | |
namespace StubbsTest.Data | |
{ | |
public class FormRepository : IDisposable | |
{ |
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
{ | |
"compilerOptions": { | |
"declaration": false, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"module": "none", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"target": "es5", | |
"inlineSources": true, |
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
import { Inject, Service } from "core/decorators"; | |
@Service("loadingService") | |
export class LoadingService { | |
private _modal: ng.ui.bootstrap.IModalServiceInstance; | |
constructor( | |
@Inject("$uibModal") private _modalService: ng.ui.bootstrap.IModalService | |
) { | |
} |
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
import { Person } from "./person"; | |
import "test"; | |
const person = new Person("Kerry", "Ritter"); | |
alert(person.fullName); |
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
public class OmgDapperRules | |
{ | |
public List<ProjectVersionField> GetAllForVersion(int projectVersionId) | |
{ | |
using (var connection = _connectionFactory.Create()) | |
{ | |
var fields = connection.Query<ProjectVersionField, ProjectTemplateField, ProjectTemplateFieldType, ProjectVersionField>(@" | |
SELECT pvf.*, ptf.*, ptft.* | |
FROM [dbo].[ProjectVersionField] pvf | |
INNER JOIN [dbo].[ProjectTemplateField] ptf ON ptf.Id = pvf.ProjectTemplateFieldId |
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
public class CigarSerializer : Serializer<Cigar, CigarDto> | |
{ | |
public Cigar Serialize(CigarDto request) | |
{ | |
return new Cigar | |
{ | |
Name = request.Name, | |
Brand = request.Brand | |
}; | |
} |
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 (var connection = new SqlConnection(_config["Connection"])) | |
{ | |
string query = @"SELECT * | |
FROM [Template] | |
WHERE [Type] = @type; | |
SELECT tct.TemplateId as TemplateId, tc.Name as CategoryName | |
FROM [TemplateCategory_Template] tct | |
JOIN [TemplateCategory] tc ON tct.TemplateCategoryId = tc.Id; |
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.Data.SqlClient; | |
using System.Configuration; | |
namespace DapperTest | |
{ | |
public static class ContextFactory | |
{ | |
public static SqlConnection Create() => new SqlConnection(ConfigurationManager.ConnectionStrings["MyCxn"].ConnectionString); | |
} | |
} |
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
public static Mock<DbSet<T>> AsMockDbSet<T>(this IEnumerable<T> data) where T : class | |
{ | |
var mockSet = new Mock<DbSet<T>>(); | |
var queryable = data.AsQueryable(); | |
mockSet.As<IQueryable<T>>().Setup(m => m.Provider).Returns(() => queryable.Provider); | |
mockSet.As<IQueryable<T>>().Setup(m => m.Expression).Returns(() => queryable.Expression); | |
mockSet.As<IQueryable<T>>().Setup(m => m.ElementType).Returns(() => queryable.ElementType); | |
mockSet.As<IQueryable<T>>().Setup(m => m.GetEnumerator()).Returns(() => queryable.GetEnumerator()); |
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
/// <summary> | |
/// Class for building CSV outputs | |
/// </summary> | |
/// <seealso cref="System.IDisposable" /> | |
public class CsvBuilder : IDisposable | |
{ | |
private readonly StringBuilder _stringBuilder; | |
private readonly string _delimiter; |