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
//Example of a model that won't work with the current JsonValueProviderFactory but will work with JsonDotNetValueProviderFactory | |
public class CmsViewModel | |
{ | |
public bool IsVisible { get; set; } | |
public string Content { get; set; } | |
public DateTime Modified { get; set; } | |
public DateTime Created { get; set; } | |
//This property will not work with the current JsonValueProviderFactory | |
public dynamic UserDefined { 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
using Ninject; | |
using Ninject.Modules; | |
using Ninject.Web.Common; | |
using Raven.Client; | |
using Raven.Client.Embedded; | |
using Raven.Database.Server; | |
namespace RavenDBInFiveMinutes | |
{ | |
public class RavenDBNinjectModule : NinjectModule |
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 IDictionary<string, object> GetUnobtrusiveValidationAttributesFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) | |
{ | |
return html.GetUnobtrusiveValidationAttributes(ExpressionHelper.GetExpressionText(expression)); | |
} |
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 MyAppConfig : JsonConfig<MyAppConfig> | |
{ | |
public string Website { get; set; } | |
public string DatabaseConnectionString { 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
<appSettings> | |
<add key="MyAppConfig" value=" | |
{ | |
'Website': 'http://dalsoft.co.uk/', | |
'DatabaseConnectionString': 'Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;' | |
}" /> | |
</appSettings> |
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.Collections.Generic; | |
using System.Web; | |
using Mindscape.Raygun4Net.Messages; | |
namespace Logging.Extensions | |
{ | |
public static class Raygun4NetExtensions | |
{ | |
public static void SetNonSensitiveHttpDetails(this RaygunMessage message) | |
{ |
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
h1 { | |
font-size: 3rem; | |
color:red; | |
} |
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
dynamic client = new RestClient("http://jsonplaceholder.typicode.com"); | |
var post = await client.Posts(1).Get(); | |
Assert.That(post.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK)); | |
Assert.That(post.id, Is.EqualTo(1)); |
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
dynamic client = new RestClient("http://jsonplaceholder.typicode.com"); | |
var post = new { title = "foo", body = "bar", userId = 10 }; | |
var result = await client.Posts(1).Put(post); | |
Assert.That(result.title, Is.EqualTo(post.title)); | |
Assert.That(result.body, Is.EqualTo(post.body)); | |
Assert.That(result.userId, Is.EqualTo(post.userId)); | |
Assert.That(result.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK)); |
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
// Method /createMessage https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-Method-messages-create | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var pushWooshResponse = await pushwoosh.CreateMessage.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
auth = "API_ACCESS_TOKEN", | |
notifications = new[] { new { | |
send_date = "now", // YYYY-MM-DD HH:mm OR 'now' |
OlderNewer