Example #1
0
 public static Parameter FromProperty(OdcmProperty arg)
 {
     return(new Parameter
     {
         Name = arg.Name.ToLowerCamelCase(),
         Type = new Type(NamesService.GetConcreteTypeName(arg.Type))
     });
 }
Example #2
0
 public static Field ForNavigationProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetPropertyFieldName(property),
         Type = new Type(NamesService.GetConcreteTypeName(property.Type))
     });
 }
 private ConcreteNavigationCollectionAccessorProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     CollectionType = new Type(NamesService.GetCollectionTypeName((OdcmClass)odcmProperty.Type));
     FieldName      = NamesService.GetConcreteFieldName(odcmProperty);
     InstanceType   = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type           = new Type(new Identifier("global::System.Collections.Generic", "IList"),
                               new Type(NamesService.GetConcreteTypeName(odcmProperty.Type)));
 }
 public EntityFunctionMethod(OdcmMethod odcmMethod)
 {
     InstanceName = NamesService.GetConcreteTypeName(odcmMethod.ReturnType);
     IsAsync      = true;
     ModelName    = odcmMethod.Name;
     Name         = odcmMethod.Name + "Async";
     Parameters   = odcmMethod.Parameters.Select(Parameter.FromOdcmParameter);
     ReturnType   = new Type(new Identifier("System.Threading.Tasks", "Task"), new Type(NamesService.GetPublicTypeName(odcmMethod.ReturnType)));
 }
Example #5
0
 public static Class ForComplex(OdcmClass odcmClass)
 {
     return(new Class
     {
         AbstractModifier = odcmClass.IsAbstract ? "abstract " : string.Empty,
         AccessModifier = "public ",
         Constructors = global::CSharpWriter.Constructors.ForComplex(odcmClass),
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("ComplexTypeBase")
                 : NamesService.GetPublicTypeName(odcmClass.Base)),
         Fields = global::CSharpWriter.Fields.ForComplex(odcmClass),
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Properties = global::CSharpWriter.Properties.ForComplex(odcmClass),
     });
 }
Example #6
0
 public static Class ForConcrete(OdcmClass odcmClass)
 {
     return(new Class
     {
         AbstractModifier = odcmClass.IsAbstract ? "abstract " : string.Empty,
         AccessModifier = "public ",
         Attributes = global::CSharpWriter.Attributes.ForConcrete(odcmClass),
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("EntityBase")
                 : NamesService.GetConcreteTypeName(odcmClass.Base)),
         Constructors = global::CSharpWriter.Constructors.ForConcrete(odcmClass),
         Fields = global::CSharpWriter.Fields.ForConcrete(odcmClass),
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForConcrete(odcmClass),
         Methods = global::CSharpWriter.Methods.ForConcrete(odcmClass),
         Properties = global::CSharpWriter.Properties.ForConcrete(odcmClass)
     });
 }
Example #7
0
        private void Write(ConcreteNavigationCollectionProperty property)
        {
            WriteDeclaration(property);

            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("return new {0}<{1}, {2}>(Context, ({3}<{2}>) {4});",
                      NamesService.GetExtensionTypeName("PagedCollection"),
                      NamesService.GetConcreteInterfaceName(property.OdcmType),
                      NamesService.GetConcreteTypeName(property.OdcmType),
                      NamesService.GetExtensionTypeName("EntityCollectionImpl"),
                      property.FieldName);
                }
            }
        }
Example #8
0
 public static Parameter FromOdcmParameter(OdcmParameter odcmParameter)
 {
     return(new Parameter
     {
         Name = odcmParameter.Name,
         Type = odcmParameter.IsCollection
             ? new Type(new Identifier("System.Collections.Generic", "ICollection"), new Type(NamesService.GetConcreteTypeName(odcmParameter.Type)))
             : TypeService.GetParameterType(odcmParameter)
     });
 }
Example #9
0
        public static IEnumerable <Constructor> ForConcrete(OdcmClass odcmClass)
        {
            var classIdentifier = NamesService.GetConcreteTypeName(odcmClass);

            return(DefaultOnly(odcmClass, classIdentifier));
        }
 protected ConcreteNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName = NamesService.GetPropertyFieldName(odcmProperty);
     FieldType = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type      = new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type));
 }
Example #11
0
 public static Field ForNavigationConcreteProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetConcreteFieldName(property),
         Type = new Type(NamesService.GetExtensionTypeName("EntityCollectionImpl"), new Type(NamesService.GetConcreteTypeName((OdcmClass)property.Type)))
     });
 }
Example #12
0
 public static Field ForStructuralProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetPropertyFieldName(property),
         Type = property.IsCollection
             ? new Type(NamesService.GetExtensionTypeName("NonEntityTypeCollectionImpl"), new Type(NamesService.GetConcreteTypeName(property.Type)))
             : TypeService.GetPropertyType(property)
     });
 }
 protected ConcreteNavigationAccessorProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetPropertyFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     Type         = new Type(NamesService.GetConcreteTypeName(odcmProperty.Type));
 }