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
var mongoCollection = database.GetCollection<MongoDocument>("Dynamic"); | |
mongoCollection.Insert( | |
new MongoDocument( | |
new BsonDocument { | |
{ "Name", "A test record" }, | |
{ "Date", new DateTime(2013,01,01) }, | |
{ "Age", 28 }, | |
{ "Complete", false } })); | |
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 MongoDB.Bson; | |
using MongoDB.Bson.Serialization; | |
using MongoDB.Bson.Serialization.IdGenerators; | |
using MongoDB.Bson.Serialization.Serializers; | |
public class MongoDocumentClassSerializer : BsonDocumentBackedClassSerializer<MongoDocument>, IBsonIdProvider | |
{ | |
public MongoDocumentClassSerializer() |
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 MongoDB.Bson; | |
using MongoDB.Bson.Serialization; | |
using MongoDB.Bson.Serialization.Attributes; | |
[Serializable] | |
[BsonSerializer(typeof(MongoDocumentClassSerializer))] | |
public class MongoDocument : BsonDocumentBackedClass | |
{ |
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
var koProvider = { | |
observable: function () { | |
return ko.observable(); | |
}, | |
computed: function (func) | |
{ | |
return ko.computed(func); | |
} | |
} |
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
<html> | |
<head> | |
<title>State machine routing prototype</title> | |
</head> | |
<body> | |
<h3>State machine routing concept</h3> | |
<p>Extremely flexible mechanism for defining routes for web applications</p> | |
<ul> | |
<li>Hierarchical | |
</li> |
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
The route state machine defined in pseudo code below is able to handle the following routes: | |
/Api/Products/ | |
/Api/Products/1 | |
/Api/Categories | |
/Api/Categories/1 | |
/Api/Products/1/Categories | |
/Api/Products/1/Categories/2 |
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
namespace PhantomExpress | |
{ | |
using System; | |
using System.Diagnostics; | |
using System.Threading.Tasks; | |
internal class Program | |
{ | |
private static int Main(string[] args) | |
{ |
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
I have a URI used to manipulate data records: | |
http://api/{AppId}/AppData/ | |
There is also the ability to retrieve several report dataviews based on the records. | |
http://api/{AppId}/ChartData/{chartId} | |
I need a mechanism so that when I POST to http://api/{AppId}/AppData/, or DELETE\PATCH to http://api/{AppId}/AppData/{id} then any cached route starting with http://api/{AppId}/ChartData/ gets invalidated. |
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
protected void Application_BeginRequest(object sender, EventArgs e) | |
{ | |
if (this.Context.Request.Path.Contains("signalr/")) | |
{ | |
this.Context.Response.AddHeader("Access-Control-Allow-Headers", "accept,origin,authorization,content-type"); | |
} | |
} |
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 void RegisterCors(HttpConfiguration httpConfiguration) | |
{ | |
WebApiCorsConfiguration corsConfig = new WebApiCorsConfiguration(); | |
corsConfig.RegisterGlobal(httpConfiguration); | |
corsConfig.ForAllOrigins().AllowMethods("GET", "POST", "PUT", "PATCH", "DELETE").AllowAllRequestHeaders(); | |
} |