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
CREATE TRIGGER [SignalR].[TrimMessages_3] | |
ON [SignalR].[Messages_3] | |
AFTER INSERT | |
AS | |
BEGIN | |
DECLARE @MaxTableSize int, | |
@BlockSize int, | |
@MaxPayloadId bigint; | |
SET @MaxTableSize = 10000; |
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
-- Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information. | |
DECLARE @SCHEMA_NAME nvarchar(32), | |
@SCHEMA_ID int, | |
@SCHEMA_TABLE_NAME nvarchar(100), | |
@TARGET_SCHEMA_VERSION int, | |
@CREATE_MESSAGE_TABLE_DML nvarchar(1000), | |
@MESSAGE_TABLE_NAME nvarchar(100), | |
@MESSAGE_TABLE_COUNT int; |
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.Data; | |
using System.Data.SqlClient; | |
using System.Threading; | |
namespace DataReaderBehavior | |
{ | |
class Program | |
{ | |
private static readonly string _connectionString = @"Data Source=(local);Initial Catalog=master;Integrated Security=SSPI;"; |
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.Data; | |
using System.Data.SqlClient; | |
using System.Threading; | |
namespace SqlDependencyConcurrency | |
{ | |
class Program | |
{ | |
private static readonly string _connectionString = "Data Source=(local);Initial Catalog=Sample;Integrated Security=SSPI;"; |
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; | |
namespace NumberCrazy | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Number(1) == 1: {0}", new Number(1) == 1); | |
Console.WriteLine("Number(2) > 1: {0}", new Number(2) > 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
var conn = $.hubConnection("url"), | |
hub = conn.createHubProxy("chat"); | |
hub.pipeline.use({ | |
incoming: function(next) { | |
return function(context) { | |
console.log("Before incoming invocation for method " + context.methodName + " on hub " + context.hubName + " with " + context.args.length + " arguments"); | |
next(context); | |
console.log("After incoming invocation for method " + context.methodName + " on hub " + context.hubName + " with " + context.args.length + " arguments"); | |
}; |
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
<%@ Page Language="C#" AutoEventWireup="true" %> | |
<%@ Import Namespace="System.Threading" %> | |
<script runat="server"> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
uint viewIndex = 0; | |
uint.TryParse(Request.QueryString["view"], out viewIndex); | |
views.ActiveViewIndex = (int)(viewIndex < views.Views.Count ? viewIndex : 0); |
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 MyHub : Hub | |
{ | |
// The hub method must be Task returning and accept an IProgress<T> | |
public async Task DoLongRunningThing(IProgress<int> progress) | |
{ | |
for (var i = 0; i <= 100; i+=5) | |
{ | |
await Task.Delay(200); | |
progress.Report(i); | |
} |
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 ChatViewModel : IChatClient | |
{ | |
private readonly ObservableCollection<Message> _messages = new ObservableCollection<Message>(); | |
public IObservableCollection<Message> Messages | |
{ | |
get { return _messages; } | |
} | |
void IChatClient.NewMessage(string message, string user) |
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
[TagHelper("@form")] | |
public static TagBuilder FormTagHelper(this RazorPage page, TagBuilder element, string action, string controller, IDictionary<string, string> route) | |
{ | |
element.Attributes["action"] = Url.Action(action, controller, route); | |
// Could implicitly write out anti-forgery token as nested hidden input field here too | |
} | |
[TagHelper("@label")] | |
public static TagBuilder LabelTagHelper(this RazorPage page, TagBuilder element, string name, string @class) |