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.Linq; | |
using System.Data.Entity; | |
namespace TestEF | |
{ | |
public class Thing | |
{ | |
public int Id { | |
get; |
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 OwershipVerification : IActionFilter | |
{ | |
public void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
foreach(var paramter in filterContext.ActionParameters) | |
{ | |
var haveAnOwner = paramter.Value as IHaveAnOwner; | |
if(haveAnOwner != null) | |
{ | |
var ownedParameter = haveAnOwner; |
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 FlexRoleUserStore<TContext, TRole, TUser> : IFlexRoleDataStore | |
where TRole : class, IFlexRole<TUser>, new() | |
where TUser : IFlexMembershipUser | |
where TContext : DbContext | |
{ | |
// ... | |
} |
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
<div ng-app="videoApp" ng-controller="VideoController"> | |
<table> | |
<thead> | |
<th>Title</th> | |
<th>Length</th> | |
<th></th> | |
</thead> | |
<tbody> | |
<tr data-id="{{video.Id}}" ng-repeat="video in videos"> |
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
app.UseCors(new CorsOptions() | |
{ | |
PolicyProvider = new CorsPolicyProvider() | |
{ | |
PolicyResolver = request => | |
{ | |
if (request.Path.StartsWithSegments(new PathString("/token"))) | |
{ | |
return Task.FromResult(new CorsPolicy { AllowAnyOrigin = 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
let PeriodValue payment rate period = | |
payment / ((1.0 + rate) ** period) | |
let PresentValue (factors: AnnuityFactors) = | |
[1 .. factors.Periods] | |
|> List.map (fun period -> PeriodValue factors.Payment factors.InterestRate (float period)) | |
|> List.sum |
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 UserManager() | |
: base(new UserStore<ApplicationUser>(new ApplicationDbContext())) | |
{ | |
UserValidator = new UserValidator<ApplicationUser>(this) { AllowOnlyAlphanumericUserNames = false }; | |
} |
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 Worker | |
{ | |
public void StartWork() | |
{ | |
for (var i = 0; i < 10; i++) | |
{ | |
OnInterestingEvent(); | |
Thread.Sleep(1000); | |
} | |
OnComplete(); |
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
<Window x:Class="WpfApplication8.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525" | |
<!-- event wire up here: --> | |
Loaded="MainWindow_Loaded"> | |
<Canvas x:Name="DrawingCanvas"> | |
</Canvas> |
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 Logger(Stream stream) : IDisposable | |
{ | |
public void Dispose() | |
{ | |
Stream.Dispose(); | |
} | |
public Stream Stream { get; set; } = stream; | |
} |
OlderNewer