Пример #1
0
 private static IEnumerable<Feature> ForOdcmClassService(OdcmServiceClass odcmClass, OdcmModel model)
 {
     return new[]
     {
         Feature.ForOdcmClassService(odcmClass, model),
     };
 }
Пример #2
0
 public static Feature ForOdcmClassService(OdcmServiceClass odcmClass, OdcmModel model)
 {
     return new Feature
     {
         Classes = global::Vipr.Writer.CSharp.Classes.ForOdcmClassService(odcmClass, model),
         Interfaces = global::Vipr.Writer.CSharp.Interfaces.ForOdcmClassService(odcmClass),
     };
 }
Пример #3
0
        public static IEnumerable<Feature> ForEntityContainer(OdcmServiceClass odcmClass, OdcmModel model)
        {
            switch (odcmClass.Kind)
            {
                case OdcmClassKind.Complex:
                case OdcmClassKind.MediaEntity:
                case OdcmClassKind.Entity:
                    return Enumerable.Empty<Feature>();

                case OdcmClassKind.Service:
                    return Features.ForOdcmClassService((OdcmServiceClass)odcmClass, model);
            }

            throw new NotImplementedException(string.Format("OdcmClassKind {0} is not recognized", odcmClass.Kind));
        }
Пример #4
0
 public static IEnumerable<Class> ForOdcmClassService(OdcmServiceClass odcmClass, OdcmModel model)
 {
     return new[] {Class.ForEntityContainer(model, odcmClass)};
 }
Пример #5
0
        public static OdcmServiceClass ServiceOdcmClass(OdcmNamespace odcmNamespace, Action<OdcmServiceClass> config = null)
        {
            var retVal = new OdcmServiceClass(Any.CSharpIdentifier(), odcmNamespace);

            var entities = odcmNamespace.Classes
                .Where(c => c.Kind == OdcmClassKind.Entity);

            foreach (var entity in entities)
            {
                retVal.Properties.Add(new OdcmProperty(entity.Name) { Class = retVal, Type = entity });

                retVal.Properties.Add(new OdcmProperty(entity.Name + "s")
                {
                    Class = retVal,
                    Type = entity,
                    IsCollection = true
                });
            }

            retVal.Methods.AddRange(Any.Sequence(s => Any.OdcmMethod()));

            if (config != null) config(retVal);

            return retVal;
        }
Пример #6
0
 public static IEnumerable<Method> ForEntityContainer(OdcmServiceClass odcmContainer)
 {
     return Methods.ForEntityContainerInterface(odcmContainer)
         .Concat(Methods.ForContainerAddToCollection(odcmContainer))
         .Concat(new Method[]
         {
             new ContainerTypeFromNameMethod(odcmContainer),
             new ContainerNameFromTypeMethod(odcmContainer),
             new ContainerGetPathMethod(),
             new ContainerGetUrlMethod()
         });
 }
Пример #7
0
 internal static Class ForEntityContainer(OdcmModel odcmModel, OdcmServiceClass odcmContainer)
 {
     return new Class
     {
         AccessModifier = "public ",
         Constructors = global::Vipr.Writer.CSharp.Constructors.ForEntityContainer(odcmContainer),
         Description = odcmContainer.Description,
         Fields = global::Vipr.Writer.CSharp.Fields.ForEntityContainer(odcmContainer),
         Interfaces = global::Vipr.Writer.CSharp.ImplementedInterfaces.ForEntityContainer(odcmContainer),
         Identifier = NamesService.GetEntityContainerTypeName(odcmContainer),
         NestedClasses = new[] { ForGeneratedEdmModel(odcmModel) },
         Methods = global::Vipr.Writer.CSharp.Methods.ForEntityContainer(odcmContainer),
         Properties = global::Vipr.Writer.CSharp.Properties.ForEntityContainer(odcmContainer)
     };
 }