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
{ | |
"Id": 1001, | |
"Date": "2012-09-12", | |
"Customer": "Guy Barette", | |
"ShippingAddress": | |
{ | |
"Address": "2000 McGill College, 4e étage, Montréal, QC", | |
"PostalCode": "H3A 3H3", | |
"Country": "Canada" | |
}, |
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
[SetUp] | |
public void SetUp() | |
{ | |
this.memoryAppender = new MemoryAppender(); | |
BasicConfigurator.Configure(this.memoryAppender); | |
... | |
} | |
[Test] |
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
void Main() | |
{ | |
Environment.CurrentDirectory = Path.GetDirectoryName(Util.CurrentQueryPath); | |
Compiler.CompileFiles(Options.CreateOnDiskDll( | |
@namespace: "LinqPad.QueriesCompiler", | |
outputFile: "LinqPad.QueriesCompiler.dll") | |
.AddCodeFile(CodeType.LinqProgramTypes, Util.CurrentQueryPath)) | |
.Dump("Successfully created assembly at " + DateTime.Now.ToLocalTime()); | |
} |
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
MiniProfilerEF.Initialize_EF42(); // When using Code First | |
ConsoleProfiling.Start(); | |
using (StackExchange.Profiling.MiniProfiler.Current.Step("StepName")) | |
{ | |
using (var context = new Context()) | |
{ | |
var result = context.Entities | |
.Where(p => p.Property.StartsWith("Value")) | |
.ToList(); |
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
var connectionString="..."; | |
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); | |
var client = storageAccount.CreateCloudTableClient(); | |
var table = client.GetTableReference("Demo"); | |
table.CreateIfNotExists(); | |
// dynamic keyword to use a dynamic entity | |
dynamic entity = new ElasticTableEntity(); | |
entity.PartitionKey = "Partition123"; |
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 ElasticTableEntity : DynamicObject, ITableEntity, | |
ICustomMemberProvider // For LinqPad's Dump | |
{ | |
public ElasticTableEntity() | |
{ | |
this.Properties = new Dictionary<string, EntityProperty>(); | |
} | |
public IDictionary<string, EntityProperty> Properties { get; private set; } | |
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 ProjectRepository | |
{ | |
private CloudTable table; | |
public ProjectRepository() | |
{ | |
var connectionString = "..."; | |
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); | |
var client = storageAccount.CreateCloudTableClient(); |
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 Project | |
{ | |
public Guid Owner { get; set; } | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public DateTime StartDate { get; set; } | |
public int Status { get; set; } | |
public List<Task> Tasks { get; set; } | |
} |
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 ProjectRepository | |
{ | |
private CloudTable table; | |
private CloudBlobContainer container; | |
public ProjectRepository() | |
{ | |
var connectionString = "..."; | |
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(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 Slice<T> GetSlice<T>(IEnumerable<Element<T>> elements, double totalSize, double sliceWidth) | |
{ | |
if (!elements.Any()) return null; | |
if (elements.Count() == 1) return new Slice<T> { Elements = elements, Size = totalSize }; | |
var sliceResult = GetElementsForSlice(elements, sliceWidth); | |
return new Slice<T> | |
{ | |
Elements = elements, |
OlderNewer