diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..1b19cb54a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=lf + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.cs text +*.json text + +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary \ No newline at end of file diff --git a/Gordon360/Models/CCT/Context/DbContextExtensions.cs b/Gordon360/Models/CCT/Context/DbContextExtensions.cs index e7095d686..edaf41b6c 100644 --- a/Gordon360/Models/CCT/Context/DbContextExtensions.cs +++ b/Gordon360/Models/CCT/Context/DbContextExtensions.cs @@ -1,68 +1,68 @@ -// This file has been auto generated by EF Core Power Tools. -using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data.Common; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Gordon360.Models.CCT.Context -{ - public static class DbContextExtensions - { - public static async Task> SqlQueryAsync(this DbContext db, string sql, object[] parameters = null, CancellationToken cancellationToken = default) where T : class - { - if (parameters is null) - { - parameters = new object[] { }; - } - - if (typeof(T).GetProperties().Any()) - { - return await db.Set().FromSqlRaw(sql, parameters).ToListAsync(cancellationToken); - } - else - { - await db.Database.ExecuteSqlRawAsync(sql, parameters, cancellationToken); - return default; - } - } - - public static async Task GetNextValueForSequence(this DbContext _context, Sequence sequence) - { - SqlParameter result = new SqlParameter("@result", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output }; - await _context.Database.ExecuteSqlRawAsync($"SELECT @result = (NEXT VALUE FOR [{CCTSequenceEnum.GetDescription(sequence)}])", result); - return (int)result.Value; - } - } - - public class OutputParameter - { - private bool _valueSet = false; - - public TValue _value; - - public TValue Value - { - get - { - if (!_valueSet) - throw new InvalidOperationException("Value not set."); - - return _value; - } - } - - internal void SetValue(object value) - { - _valueSet = true; - - _value = null == value || Convert.IsDBNull(value) ? default(TValue) : (TValue)value; - } - } -} +// This file has been auto generated by EF Core Power Tools. +using Microsoft.Data.SqlClient; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data.Common; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Gordon360.Models.CCT.Context +{ + public static class DbContextExtensions + { + public static async Task> SqlQueryAsync(this DbContext db, string sql, object[] parameters = null, CancellationToken cancellationToken = default) where T : class + { + if (parameters is null) + { + parameters = new object[] { }; + } + + if (typeof(T).GetProperties().Any()) + { + return await db.Set().FromSqlRaw(sql, parameters).ToListAsync(cancellationToken); + } + else + { + await db.Database.ExecuteSqlRawAsync(sql, parameters, cancellationToken); + return default; + } + } + + public static async Task GetNextValueForSequence(this DbContext _context, Sequence sequence) + { + SqlParameter result = new SqlParameter("@result", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output }; + await _context.Database.ExecuteSqlRawAsync($"SELECT @result = (NEXT VALUE FOR [{CCTSequenceEnum.GetDescription(sequence)}])", result); + return (int)result.Value; + } + } + + public class OutputParameter + { + private bool _valueSet = false; + + public TValue _value; + + public TValue Value + { + get + { + if (!_valueSet) + throw new InvalidOperationException("Value not set."); + + return _value; + } + } + + internal void SetValue(object value) + { + _valueSet = true; + + _value = null == value || Convert.IsDBNull(value) ? default(TValue) : (TValue)value; + } + } +}