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 class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
// ADD ACTION TO routeTemplate BELOW!!! | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{action}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); |
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 interface IHello | |
{ | |
string Message(); | |
} | |
[Export(typeof(IHello))] | |
public class Hello : IHello | |
{ | |
public string 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
public class CustomerManager : ICustomerManager | |
{ | |
[Import] | |
public ICustomerAccessor CustomerAccessor { get; set; } | |
public void Upgrade(string customerId) | |
{ | |
// To upgrade a customer we must first find the customer. | |
var customer = CustomerAccessor.Find(customerId); | |
// Set Pro equal to 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
public class MyTests | |
{ | |
TransactionScope _testTransactionScope; | |
#region transaction scope | |
[TestInitialize] | |
public void TestInitialize() | |
{ |
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 AccessorFactory | |
{ | |
public virtual T Create<T>() | |
where T : class | |
{ | |
if (typeof(T).Name == "CustomerAccessor") | |
return new CustomerAccessor() as T; | |
return null; | |
} |
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 a transaction because we are using a transactional queue. | |
using (var trn = new MessageQueueTransaction()) | |
{ | |
try | |
{ | |
// Create queue object | |
using (var queue = new MessageQueue(@".\private$\testqueue")) | |
{ | |
queue.Formatter = new XmlMessageFormatter(); |
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 partial class Service1 : ServiceBase | |
{ | |
private MessageQueue _queue; | |
public Service1() | |
{ | |
InitializeComponent(); | |
} | |
protected override void OnStart(string[] args) |
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 request = new Amazon.SQS.Model.SendMessageRequest(); | |
request.QueueUrl = url; | |
request.MessageBody = "a simple body"; | |
using (var client = new Amazon.SQS.AmazonSQSClient(key, secret)) | |
{ | |
client.SendMessage(request); | |
} |
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 request = new Amazon.SQS.Model.ReceiveMessageRequest(); | |
request.QueueUrl = url; | |
using (var client = new Amazon.SQS.AmazonSQSClient(key, secret)) | |
{ | |
var response = client.ReceiveMessage(request); | |
} |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount; | |
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); | |
// Retrieve a reference to a queue. | |
CloudQueue queue = queueClient.GetQueueReference("myqueue"); |
OlderNewer