Permalink
Browse files

Minor Spelling/Grammar Corrections

On some, it looks like a bigger changes, but that is just because my IDE
cleansed some of the intermix of tabs & spaces in the code layout.
  • Loading branch information...
1 parent 9503a88 commit 3949c1dc7143a4203c2bb690666ea13a154203be @VeXHarbinger VeXHarbinger committed Dec 5, 2012
@@ -1,76 +1,76 @@
-using ServiceStack.CacheAccess;
-using ServiceStack.Common;
-using ServiceStack.Northwind.ServiceModel.Operations;
-using ServiceStack.ServiceHost;
-using ServiceStack.ServiceInterface;
-
-namespace ServiceStack.Northwind.ServiceInterface
-{
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class CachedCustomersService : RestServiceBase<CachedCustomers>
- {
- /// <summary>
- /// Gets or sets the cache client. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public ICacheClient CacheClient { get; set; }
-
- public override object OnGet(CachedCustomers request)
- {
- //Manually create the Unified Resource Name "urn:customers".
- return base.RequestContext.ToOptimizedResultUsingCache(
- this.CacheClient, "urn:customers", () =>
- {
- //Resolve the service in order to get the customers.
- var service = this.ResolveService<CustomersService>();
- return (CustomersResponse)service.Get(new Customers());
- });
- }
- }
-
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class CachedCustomerDetailsService : RestServiceBase<CachedCustomerDetails>
- {
- /// <summary>
- /// Gets or sets the cache client. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public ICacheClient CacheClient { get; set; }
-
- public override object OnGet(CachedCustomerDetails request)
- {
- //Create the Unified Resource Name "urn:customerdetails:{id}".
- var cacheKey = UrnId.Create<CustomerDetails>(request.Id);
- return base.RequestContext.ToOptimizedResultUsingCache(
- this.CacheClient, cacheKey, () =>
- {
- return (CustomerDetailsResponse)this.ResolveService<CustomerDetailsService>()
- .Get(new CustomerDetails { Id = request.Id });
- });
- }
- }
-
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class CachedOrdersService : RestServiceBase<CachedOrders>
- {
- /// <summary>
- /// Gets or sets the cache client. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public ICacheClient CacheClient { get; set; }
-
- public override object OnGet(CachedOrders request)
- {
- var cacheKey = UrnId.Create<Orders>(request.CustomerId ?? "all", request.Page.GetValueOrDefault(0).ToString());
- return base.RequestContext.ToOptimizedResultUsingCache(this.CacheClient, cacheKey, () =>
- {
- return (OrdersResponse)this.ResolveService<OrdersService>()
- .Get(new Orders { CustomerId = request.CustomerId, Page = request.Page });
- });
- }
- }
-
-}
+using ServiceStack.CacheAccess;
+using ServiceStack.Common;
+using ServiceStack.Northwind.ServiceModel.Operations;
+using ServiceStack.ServiceHost;
+using ServiceStack.ServiceInterface;
+
+namespace ServiceStack.Northwind.ServiceInterface
+{
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class CachedCustomersService : RestServiceBase<CachedCustomers>
+ {
+ /// <summary>
+ /// Gets or sets the cache client. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public ICacheClient CacheClient { get; set; }
+
+ public override object OnGet(CachedCustomers request)
+ {
+ //Manually create the Unified Resource Name "urn:customers".
+ return base.RequestContext.ToOptimizedResultUsingCache(
+ this.CacheClient, "urn:customers", () =>
+ {
+ //Resolve the service in order to get the customers.
+ var service = this.ResolveService<CustomersService>();
+ return (CustomersResponse)service.Get(new Customers());
+ });
+ }
+ }
+
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class CachedCustomerDetailsService : RestServiceBase<CachedCustomerDetails>
+ {
+ /// <summary>
+ /// Gets or sets the cache client. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public ICacheClient CacheClient { get; set; }
+
+ public override object OnGet(CachedCustomerDetails request)
+ {
+ //Create the Unified Resource Name "urn:customerdetails:{id}".
+ var cacheKey = UrnId.Create<CustomerDetails>(request.Id);
+ return base.RequestContext.ToOptimizedResultUsingCache(
+ this.CacheClient, cacheKey, () =>
+ {
+ return (CustomerDetailsResponse)this.ResolveService<CustomerDetailsService>()
+ .Get(new CustomerDetails { Id = request.Id });
+ });
+ }
+ }
+
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class CachedOrdersService : RestServiceBase<CachedOrders>
+ {
+ /// <summary>
+ /// Gets or sets the cache client. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public ICacheClient CacheClient { get; set; }
+
+ public override object OnGet(CachedOrders request)
+ {
+ var cacheKey = UrnId.Create<Orders>(request.CustomerId ?? "all", request.Page.GetValueOrDefault(0).ToString());
+ return base.RequestContext.ToOptimizedResultUsingCache(this.CacheClient, cacheKey, () =>
+ {
+ return (OrdersResponse)this.ResolveService<OrdersService>()
+ .Get(new Orders { CustomerId = request.CustomerId, Page = request.Page });
+ });
+ }
+ }
+
+}
@@ -1,38 +1,38 @@
-using System;
-using System.Net;
-using ServiceStack.Common.Web;
-using ServiceStack.Northwind.ServiceModel.Operations;
-using ServiceStack.Northwind.ServiceModel.Types;
-using ServiceStack.OrmLite;
-using ServiceStack.ServiceInterface;
-
-namespace ServiceStack.Northwind.ServiceInterface
-{
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class CustomerDetailsService : RestServiceBase<CustomerDetails>
- {
- /// <summary>
- /// Gets or sets the database factory. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public IDbConnectionFactory DbFactory { get; set; }
-
- public override object OnGet(CustomerDetails request)
- {
- var customer = DbFactory.Run(dbCmd => dbCmd.GetByIdOrDefault<Customer>(request.Id));
- if (customer == null)
- throw new HttpError(HttpStatusCode.NotFound,
- new ArgumentException("Customer does not exist: " + request.Id));
-
- var ordersService = base.ResolveService<OrdersService>();
- var ordersResponse = (OrdersResponse)ordersService.Get(new Orders { CustomerId = customer.Id });
-
- return new CustomerDetailsResponse
- {
- Customer = customer,
- CustomerOrders = ordersResponse.Results,
- };
- }
- }
-}
+using System;
+using System.Net;
+using ServiceStack.Common.Web;
+using ServiceStack.Northwind.ServiceModel.Operations;
+using ServiceStack.Northwind.ServiceModel.Types;
+using ServiceStack.OrmLite;
+using ServiceStack.ServiceInterface;
+
+namespace ServiceStack.Northwind.ServiceInterface
+{
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class CustomerDetailsService : RestServiceBase<CustomerDetails>
+ {
+ /// <summary>
+ /// Gets or sets the database factory. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public IDbConnectionFactory DbFactory { get; set; }
+
+ public override object OnGet(CustomerDetails request)
+ {
+ var customer = DbFactory.Run(dbCmd => dbCmd.GetByIdOrDefault<Customer>(request.Id));
+ if (customer == null)
+ throw new HttpError(HttpStatusCode.NotFound,
+ new ArgumentException("Customer does not exist: " + request.Id));
+
+ var ordersService = base.ResolveService<OrdersService>();
+ var ordersResponse = (OrdersResponse)ordersService.Get(new Orders { CustomerId = customer.Id });
+
+ return new CustomerDetailsResponse
+ {
+ Customer = customer,
+ CustomerOrders = ordersResponse.Results,
+ };
+ }
+ }
+}
@@ -1,23 +1,23 @@
-using ServiceStack.Northwind.ServiceModel.Operations;
-using ServiceStack.Northwind.ServiceModel.Types;
-using ServiceStack.OrmLite;
-using ServiceStack.ServiceInterface;
-
-namespace ServiceStack.Northwind.ServiceInterface
-{
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class CustomersService : RestServiceBase<Customers>
- {
- /// <summary>
- /// Gets or sets the database factory. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public IDbConnectionFactory DbFactory { get; set; }
-
- public override object OnGet(Customers request)
- {
- return new CustomersResponse { Customers = DbFactory.Run(dbCmd => dbCmd.Select<Customer>()) };
- }
- }
-}
+using ServiceStack.Northwind.ServiceModel.Operations;
+using ServiceStack.Northwind.ServiceModel.Types;
+using ServiceStack.OrmLite;
+using ServiceStack.ServiceInterface;
+
+namespace ServiceStack.Northwind.ServiceInterface
+{
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class CustomersService : RestServiceBase<Customers>
+ {
+ /// <summary>
+ /// Gets or sets the database factory. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public IDbConnectionFactory DbFactory { get; set; }
+
+ public override object OnGet(Customers request)
+ {
+ return new CustomersResponse { Customers = DbFactory.Run(dbCmd => dbCmd.Select<Customer>()) };
+ }
+ }
+}
@@ -1,48 +1,48 @@
-using System.Linq;
-using ServiceStack.Common.Extensions;
-using ServiceStack.Northwind.ServiceModel.Operations;
-using ServiceStack.Northwind.ServiceModel.Types;
-using ServiceStack.OrmLite;
-using ServiceStack.ServiceInterface;
-
-namespace ServiceStack.Northwind.ServiceInterface
-{
- /// <summary>
- /// Create your ServiceStack rest-ful web service implementation.
- /// </summary>
- public class OrdersService : RestServiceBase<Orders>
- {
- private const int PageCount = 20;
-
- /// <summary>
- /// Gets or sets the database factory. The built-in IoC used with ServiceStack autowires this property.
- /// </summary>
- public IDbConnectionFactory DbFactory { get; set; }
-
- public override object OnGet(Orders request)
- {
- using (var dbConn = DbFactory.OpenDbConnection())
- {
- var orders = request.CustomerId.IsNullOrEmpty()
- ? dbConn.Select<Order>("ORDER BY OrderDate DESC LIMIT {0}, {1}", (request.Page.GetValueOrDefault(1) - 1) * PageCount, PageCount)
- : dbConn.Select<Order>("CustomerId = {0}", request.CustomerId);
-
- if (orders.Count == 0) { return new OrdersResponse(); }
-
- var orderDetails = dbConn.Select<OrderDetail>(
- "OrderId IN ({0})", new SqlInValues(orders.ConvertAll(x => x.Id)));
-
- var orderDetailsLookup = orderDetails.ToLookup(o => o.OrderId);
-
- var customerOrders = orders.ConvertAll(o =>
- new CustomerOrder
- {
- Order = o,
- OrderDetails = orderDetailsLookup[o.Id].ToList()
- });
-
- return new OrdersResponse { Results = customerOrders };
- }
- }
- }
-}
+using System.Linq;
+using ServiceStack.Common.Extensions;
+using ServiceStack.Northwind.ServiceModel.Operations;
+using ServiceStack.Northwind.ServiceModel.Types;
+using ServiceStack.OrmLite;
+using ServiceStack.ServiceInterface;
+
+namespace ServiceStack.Northwind.ServiceInterface
+{
+ /// <summary>
+ /// Create your ServiceStack RESTful web service implementation.
+ /// </summary>
+ public class OrdersService : RestServiceBase<Orders>
+ {
+ private const int PageCount = 20;
+
+ /// <summary>
+ /// Gets or sets the database factory. The built-in IoC used with ServiceStack auto wires this property.
+ /// </summary>
+ public IDbConnectionFactory DbFactory { get; set; }
+
+ public override object OnGet(Orders request)
+ {
+ using (var dbConn = DbFactory.OpenDbConnection())
+ {
+ var orders = request.CustomerId.IsNullOrEmpty()
+ ? dbConn.Select<Order>("ORDER BY OrderDate DESC LIMIT {0}, {1}", (request.Page.GetValueOrDefault(1) - 1) * PageCount, PageCount)
+ : dbConn.Select<Order>("CustomerId = {0}", request.CustomerId);
+
+ if (orders.Count == 0) { return new OrdersResponse(); }
+
+ var orderDetails = dbConn.Select<OrderDetail>(
+ "OrderId IN ({0})", new SqlInValues(orders.ConvertAll(x => x.Id)));
+
+ var orderDetailsLookup = orderDetails.ToLookup(o => o.OrderId);
+
+ var customerOrders = orders.ConvertAll(o =>
+ new CustomerOrder
+ {
+ Order = o,
+ OrderDetails = orderDetailsLookup[o.Id].ToList()
+ });
+
+ return new OrdersResponse { Results = customerOrders };
+ }
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit 3949c1d

Please sign in to comment.