Esempio n. 1
0
 public ObsoletedNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     Type = odcmProperty.IsCollection
         ? new Type(new Identifier("global::System.Collections.Generic", "IList"),
                    new Type(NamesService.GetConcreteTypeName(odcmProperty.Type)))
         : new Type(NamesService.GetConcreteTypeName(odcmProperty.Type));
 }
Esempio n. 2
0
 protected FetcherNavigationCollectionProperty(OdcmProperty odcmProperty)
     : base(odcmProperty)
 {
     CollectionType = new Type(NamesService.GetCollectionTypeName((OdcmClass)odcmProperty.Type));
     FieldName      = NamesService.GetFetcherCollectionFieldName(odcmProperty);
     InstanceType   = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type           = new Type(NamesService.GetCollectionInterfaceName((OdcmClass)odcmProperty.Type));
 }
Esempio n. 3
0
 public static Parameter FromProperty(OdcmProperty arg)
 {
     return(new Parameter
     {
         Name = arg.Name.ToLowerCamelCase(),
         Type = new Type(NamesService.GetConcreteTypeName(arg.Type))
     });
 }
Esempio n. 4
0
 public static Field ForNavigationProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetPropertyFieldName(property),
         Type = new Type(NamesService.GetConcreteTypeName(property.Type))
     });
 }
Esempio n. 5
0
 public EnsureQueryMethod(OdcmClass odcmClass)
 {
     Visibility           = Visibility.Private;
     Name                 = "EnsureQuery";
     FetchedType          = new Type(NamesService.GetConcreteTypeName(odcmClass));
     FetchedTypeInterface = new Type(NamesService.GetConcreteInterfaceName(odcmClass));
     ReturnType           = new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSet"), new Type(NamesService.GetConcreteInterfaceName(odcmClass)));
 }
 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)));
 }
Esempio n. 7
0
 public static Class ForConcreteIFetcherUpcastMethods(OdcmEntityClass odcmClass)
 {
     return(new Class
     {
         AccessModifier = "public ",
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Methods = global::Vipr.Writer.CSharp.Methods.ForConcreteUpcasts(odcmClass),
     });
 }
Esempio n. 8
0
        private void Write(CollectionGetByIdIndexer indexer)
        {
            WriteSignature(indexer);
            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("var path = GetPath<{0}>((i) => {1});", NamesService.GetConcreteTypeName(indexer.OdcmClass), indexer.ParameterToPropertyMap.ToEquivalenceString("i"));
                    _("var fetcher = new {0}();", NamesService.GetFetcherTypeName(indexer.OdcmClass));
                    _("fetcher.Initialize(Context, path);");
                    _("");
                    _("return fetcher;");
                }
            }
        }
Esempio n. 9
0
 public static Class ForComplex(OdcmClass odcmClass)
 {
     return(new Class
     {
         AbstractModifier = odcmClass.IsAbstract ? "abstract " : string.Empty,
         AccessModifier = "public ",
         Constructors = global::Vipr.Writer.CSharp.Constructors.ForComplex(odcmClass),
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("ComplexTypeBase")
                 : NamesService.GetPublicTypeName(odcmClass.Base)),
         Description = odcmClass.Description,
         Fields = global::Vipr.Writer.CSharp.Fields.ForComplex(odcmClass),
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Properties = global::Vipr.Writer.CSharp.Properties.ForComplex(odcmClass),
     });
 }
Esempio n. 10
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),
                      "DataServiceCollection",
                      property.Name);
                }
            }
        }
Esempio n. 11
0
 public static Class ForConcrete(OdcmEntityClass odcmClass)
 {
     return(new Class
     {
         AbstractModifier = odcmClass.IsAbstract ? "abstract " : string.Empty,
         AccessModifier = "public ",
         Attributes = global::Vipr.Writer.CSharp.Attributes.ForConcrete(odcmClass),
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("EntityBase")
                 : NamesService.GetConcreteTypeName(odcmClass.Base)),
         Constructors = global::Vipr.Writer.CSharp.Constructors.ForConcrete(odcmClass),
         Description = odcmClass.Description,
         Fields = global::Vipr.Writer.CSharp.Fields.ForConcrete(odcmClass),
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Interfaces = global::Vipr.Writer.CSharp.ImplementedInterfaces.ForConcrete(odcmClass),
         Methods = global::Vipr.Writer.CSharp.Methods.ForConcrete(odcmClass),
         Properties = global::Vipr.Writer.CSharp.Properties.ForConcrete(odcmClass)
     });
 }
Esempio n. 12
0
 public static Parameter FromOdcmParameter(OdcmParameter odcmParameter)
 {
     return(new Parameter
     {
         Name = odcmParameter.Name,
         Description = odcmParameter.Description,
         Type = odcmParameter.IsCollection
             ? new Type(new Identifier("System.Collections.Generic", "ICollection"), new Type(NamesService.GetConcreteTypeName(odcmParameter.Type)))
             : TypeService.GetParameterType(odcmParameter)
     });
 }
Esempio n. 13
0
        public static IEnumerable <Constructor> ForConcrete(OdcmClass odcmClass)
        {
            var classIdentifier = NamesService.GetConcreteTypeName(odcmClass);

            return(DefaultOnly(odcmClass, classIdentifier));
        }
Esempio n. 14
0
 protected ConcreteNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName = NamesService.GetPropertyFieldName(odcmProperty);
     FieldType = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type      = new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type));
 }
Esempio n. 15
0
 public static Field ForConcreteNavigationCollectionProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetConcreteFieldName(property),
         Type = new Type(NamesService.GetExtensionTypeName("EntityCollectionImpl"), new Type(NamesService.GetConcreteTypeName((OdcmClass)property.Type)))
     });
 }
Esempio n. 16
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)
     });
 }
Esempio n. 17
0
 public EntityInstanceFunctionMethod(OdcmMethod odcmMethod) : base(odcmMethod)
 {
     InstanceName = NamesService.GetConcreteTypeName(odcmMethod.ReturnType);
     ReturnType   = Type.TaskOf(new Type(NamesService.GetPublicTypeName(odcmMethod.ReturnType)));
 }
Esempio n. 18
0
 protected ConcreteNavigationAccessorProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetPropertyFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     Type         = new Type(NamesService.GetConcreteTypeName(odcmProperty.Type));
 }