コード例 #1
0
ファイル: RestService.cs プロジェクト: jseijas/supido
 public Message Get(Message message)
 {
     MessageInformation information = new MessageInformation(message);
     try
     {
         string sessionToken = this.GetSessionToken(information);
         MessagePath path = new MessagePath(information);
         ISecurityManager securityManager = IoC.Get<ISecurityManager>();
         object response;
         if (path.IsByParent)
         {
             MessagePath parentPath = new MessagePath(information, true);
             if (!parentPath.HasKeyParameter)
             {
                 throw new ArgumentException("A link to a parent must have parameter key");
             }
             dynamic bo = securityManager.DynamicGetBO(parentPath.DtoType, sessionToken);
             object parent = bo.GetOne(string.Empty, parentPath.QueryInfo);
             IObjectProxy proxy = ObjectProxyFactory.Get(parent);
             object value = proxy.GetValue(parent, path.ParentKeyParameter);
             QueryInfo query = new QueryInfo();
             query.Equal(path.KeyParameterName, value.ToString());
             bo = securityManager.DynamicGetBO(path.DtoType, sessionToken);
             response = bo.GetOne(string.Empty, query);
         }
         else
         {
             dynamic bo = securityManager.DynamicGetBO(path.DtoType, sessionToken);
             if (path.HasKeyParameter)
             {
                 response = bo.GetOne(string.Empty, path.QueryInfo);
             }
             else
             {
                 response = bo.GetAll(path.QueryInfo);
             }
         }
         IServiceConfiguration configuration = IoC.Get<IServiceConfiguration>();
         JsonSerializerSettings settings = IoC.Get<JsonSerializerSettings>();
         if (configuration.IsHateoas)
         {
             response = this.ConvertToHateoas(response, configuration, path);
         }
         return response.ToJsonMessage(settings, configuration.Indented);
     }
     catch (Exception ex)
     {
         if (ex is TargetInvocationException)
         {
             return ex.InnerException.Message.ToJsonMessage();
         }
         else
         {
             return ex.Message.ToJsonMessage();
         }
     }
 }
コード例 #2
0
ファイル: QueryInfo.cs プロジェクト: jseijas/supido
 /// <summary>
 /// Adds the facets from another query info.
 /// </summary>
 /// <param name="src">The source.</param>
 public void AddFacetsFrom(QueryInfo src)
 {
     foreach (FacetInfo facet in src.Facets)
     {
         foreach (FacetValueInfo value in facet.Values)
         {
             this.Where(facet.Name, value.Operation, value.Value);
         }
     }
 }
コード例 #3
0
ファイル: BaseBOFilter.cs プロジェクト: jseijas/supido
 /// <summary>
 /// Applies the where filter.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="info">The information.</param>
 /// <returns></returns>
 protected abstract IQueryable ApplyWhereFilter(IQueryable query, QueryInfo info);
コード例 #4
0
ファイル: BaseBOFilter.cs プロジェクト: jseijas/supido
 /// <summary>
 /// Applies the order filter.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="info">The information.</param>
 /// <returns></returns>
 protected abstract IQueryable ApplyOrderFilter(IQueryable query, QueryInfo info);