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
Server server = null; | |
Client client = null; | |
FirefoxDriver driver = null; | |
try | |
{ | |
// Supply the path to the Browsermob Proxy batch file | |
server = new Server(ConfigurationManager.AppSettings["BrowserMobBatFile"], 3333); | |
server.Start(); | |
client = server.CreateProxy(); |
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
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("My Category", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace); |
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.Diagnostics; | |
using System.Globalization; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System; | |
using System.Globalization; |
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 class MimeTypeUtility | |
{ | |
private const string OctetStream = "application/octet-stream"; | |
private static readonly Dictionary<string, string> MimeTypesDictionary = new Dictionary<string, string> | |
{ | |
{"ai", "application/postscript"}, | |
{"aif", "audio/x-aiff"}, | |
{"aifc", "audio/x-aiff"}, | |
{"aiff", "audio/x-aiff"}, |
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 void PopulateDataTypesRandom() | |
{ | |
using (var package = SpreadsheetDocumentWrapper.Open("MyWorkbook.xlsx")) | |
{ | |
var table = package.WorkbookPart.GetTablePart("DataTypes").Table; | |
var data = new List<object[]>(); | |
for (var i = 0; i < 10; i++) | |
{ | |
data.Add(new |
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 System.Text; | |
using System.Threading.Tasks; | |
namespace BlogCode | |
{ | |
public abstract class RepositoryBase<TEntity, TIDType, TLinqEntity, TContext> : IRepository<TEntity, TIDType, TLinqEntity, TContext>, IDisposable | |
where TEntity : AbstractBaseData<TIDType> | |
where TLinqEntity : EntityObject |
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 DataMapper<TEntity, TIDType, TLinqEntity> : IDataMapper<TEntity, TIDType, TLinqEntity> | |
where TEntity : AbstractBaseData<TIDType> | |
where TLinqEntity : EntityObject | |
{ | |
public IList<TEntity> GetEntitiesFromEF(IList<TLinqEntity> linqEntities) | |
{ | |
Mapper.Initialize | |
( | |
cfg => | |
{ |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Backup database...."); | |
Backup(); | |
Console.WriteLine("Migrate database ..."); | |
var config = new Configuration(); | |
//... (set up the config object) |
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 AddTodoCommand : IRequest<Guid> | |
{ | |
public string Name { get; set; } | |
} | |
public class AddTodoCommandHandler : IRequestHandler<AddTodoCommand, Guid> | |
{ | |
private readonly TodoDbContext _context; | |
public AddTodoCommandHandler(TodoDbContext context) | |
{ |
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 CompleteTodoCommand : IRequest<bool> | |
{ | |
public Guid Id { get; set; } | |
} | |
public class CompleteTodoCommandHadler : IRequestHandler<CompleteTodoCommand, bool> | |
{ | |
private readonly TodoDbContext _context; | |
public CompleteTodoCommandHadler(TodoDbContext context) | |
{ |
OlderNewer