public void WriteOperationsSpec(IEntity entity)
 {
     foreach (IEntityOperation operation in entity.Operations)
     {
         cw.WriteLine(RestServiceHelper.GetRestServiceSpec(entity, GetServiceMethodName(operation)));
     }
 }
Exemple #2
0
        private void WriteRequestClass(IEntity entity)
        {
            cw.WriteLine("[DataContract]");
            cw.WriteLine(RestServiceHelper.GetRestServiceSpec(entity, String.Empty));
            if (entity.Persistence.Persisted)
            {
                cw.WriteLine(RestServiceHelper.GetRestServiceSpec(entity, entity.Constraints.PrimaryId.Attributes));
                foreach (IUniqueId uid in entity.Constraints.UniqueIds)
                {
                    cw.WriteLine(RestServiceHelper.GetRestServiceSpec(entity, uid.Attributes));
                }
                foreach (IRelation r in entity.Parents)
                {
                    cw.WriteLine(RestServiceHelper.GetRestServiceSpec(entity, r.ChildAttributes));
                }

                cw.WriteLine(RestServiceHelper.GetRestServiceSpec(
                                 entity,
                                 String.Format("/{0}/{{{0}}}/{1}/{{{1}}}/{2}/{{{2}}}/{3}/{{{3}}}",
                                               NamingHelperStack.ParamName_PageNumber,
                                               NamingHelperStack.ParamName_PageSize,
                                               NamingHelperStack.ParamName_SortOrderProperty,
                                               NamingHelperStack.ParamName_SortOrderAsc)));
            }

            oph.WriteOperationsSpec(entity);

            cw.BeginClass(AccessLevel.Public,
                          true,
                          NamingHelperStack.ToServiceRequestName(entity, null),
                          Const.EmptyName);

            intfh.WriteProperties(entity.Constraints.PrimaryId.Attributes);
            foreach (IUniqueId uid in entity.Constraints.UniqueIds)
            {
                intfh.WriteProperties(uid.Attributes);
            }
            foreach (IRelation r in entity.Parents)
            {
                intfh.WriteProperties(r.ChildAttributes);
            }

            intfh.WriteProperty("string", NamingHelperStack.ParamName_Query);
            intfh.WriteProperty(NamingHelper.ClassName_ServicesQueryParams, NamingHelperStack.ParamName_QueryParams);
            intfh.WritePaginationProperties(entity);

            intfh.WriteProperty(NamingHelper.ToDTOTypeName(entity, null),
                                NamingHelper.ToDTOPropertyName(entity));

            oph.WriteParamClassesProperties(entity);
            cw.WriteLine();

            cw.EndClass();

            cw.WriteLine();
            oph.WriteParamClasses(entity);
        }
 public static string GetRestServicePath(IEntityOperation operation)
 {
     return(RestServiceHelper.GetRestServicePath(operation.Entity, operation.Name));
 }