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
/// <summary> | |
/// Inspired from: https://platform.deloitte.com.au/articles/dependency-injections-on-azure-functions-v2 | |
/// </summary> | |
public class ContainerBuilder : IContainerBuilder | |
{ | |
private readonly IServiceCollection services; | |
public ContainerBuilder() | |
{ | |
services = new ServiceCollection(); |
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.IO; | |
using ExcelDataReader; | |
using System.Text; | |
using Newtonsoft.Json; | |
namespace AzureFridayToJson | |
{ | |
class Program | |
{ |
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
public class AddressInfo | |
{ | |
public string address { get; set; } | |
public string streetNumber { get; set; } | |
public string street { get; set; } | |
public string city { get; set; } | |
public string state { get; set; } | |
public string postalCode { get; set; } | |
public string country { get; set; } | |
} |
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
[ContentType( | |
DisplayName = "Global Search", | |
GUID = "1B83AF7C-BC4B-4A13-8AAB-B9313D25D284", | |
GroupName = Global.PageGroups.Content, | |
Description = "")] | |
public class GlobalSearchPage : SitePageBase, IAllowedPageType | |
{ | |
[Display( | |
Name = "Page Types", | |
GroupName = SystemTabNames.Content, |
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
public class DatabaseMigrator : IDatabaseMigrator | |
{ | |
private readonly ILog log = LogManager.GetLogger(typeof(DatabaseMigrator)); | |
private UpgradeEngine engine; | |
private readonly string connectionString; | |
private const string JournalSchema = "dbo"; | |
private const string JournalTable = "__SchemaVersions"; | |
public DatabaseMigrator(string connectionString) | |
{ |
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
SELECT | |
database_name = DB_NAME(database_id) | |
, log_size_mb = CAST(SUM(CASE WHEN type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(8,2)) | |
, row_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(8,2)) | |
, total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(8,2)) | |
FROM sys.master_files WITH(NOWAIT) | |
WHERE database_id = DB_ID() -- for current db | |
GROUP BY database_id |
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
-- Displays larges tables with their number of rows and sizes in MB/GB | |
CREATE TABLE #temp ( | |
table_name sysname , | |
row_count INT, | |
reserved_size VARCHAR(50), | |
data_size VARCHAR(50), | |
index_size VARCHAR(50), | |
unused_size VARCHAR(50)) | |
SET NOCOUNT ON |
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
internal class TraceExceptionLogger : ExceptionLogger | |
{ | |
private readonly Log _log; | |
public TraceExceptionLogger() | |
{ | |
_log = new Log(); | |
} | |
public override void Log(ExceptionLoggerContext context) |
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
public static class ModelStateCollectionExt | |
{ | |
public static void Update(this ModelStateDictionary modelState, ValidationResult result, bool usePropertyNames = false) | |
{ | |
if (result.IsValid) | |
return; | |
foreach (var error in result.Errors) | |
{ | |
// If we exclude the property name the error will show up in the validation summary |
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
function (target, field) { | |
var path | |
if (field) { | |
path = field.split('.'); | |
path.forEach(function (key) { | |
if (target && target[key]) { | |
target = target[key]; | |
} | |
}); | |
} |