Skip to content

Commit

Permalink
Updated these for demonstration purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
EntitySpaces committed Mar 18, 2012
1 parent d4a66eb commit 80df596
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
36 changes: 35 additions & 1 deletion Examples/EntitySpaces/esJson.Custom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,45 @@
using EntitySpaces.DynamicQuery;

using BusinessObjects;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Web;
using System.Web.Script.Services;
using EntitySpaces.Core;

namespace EntitySpaces.Services
{
public partial class esJson
{
private void Authenticate()
{
// A couple of ways to get at the cookie

//--------------------------------------------------
// Commented out but probably the easier way
//--------------------------------------------------
/*
var req = HttpContext.Current.Request;
string cookieValue = req.Cookies[0].Value;
*/

//--------------------------------------------------------------------------------------
// Of course, this isn't enough security, you could for instance store the user id and
// the ip address in the cookie, and verify this information in the user table, that you
// would have filled in when the user logged in.
//
// Here we are just ensuring any ol' cookie exists to show you how your WCF service can
// get to this information.
//--------------------------------------------------------------------------------------
var properties = OperationContext.Current.IncomingMessageProperties;
var property = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
if (string.IsNullOrEmpty(property.Headers["Cookie"]))
{
//HttpContext.Current.Response.End();
throw new Exception("Not Authenticated");
}
}

[WebInvoke(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public jsResponse<EmployeesCollection, Employees> Employees_LoadHierarchical()
{
Expand Down Expand Up @@ -120,7 +154,7 @@ public jsResponse<EmployeesCollection, Employees> Employees_Pager(jsPagerRequest
for (int i = 0; i < request.filterCriteria.Length; i++)
{
jsPagerFilterCriteria filter = request.filterCriteria[i];
comp = q.Where(filter.column, filter.operation, filter.criteria1, filter.criteria2, filter.conjuction);
comp = q.ManualWhere(filter.column, filter.operation, filter.criteria1, filter.criteria2, filter.conjuction);
}

q.Where(comp);
Expand Down
4 changes: 2 additions & 2 deletions Examples/EntitySpaces/esJson.svc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC
http://www.entityspaces.net
===============================================================================
EntitySpaces Version : 2012.1.0229.0
EntitySpaces Version : 2012.1.0319.0
EntitySpaces Driver : SQL
Date Generated : 3/13/2012 7:11:10 PM
Date Generated : 3/18/2012 7:37:34 AM
===============================================================================
*/

Expand Down

0 comments on commit 80df596

Please sign in to comment.