Exemplo n.º 1
0
 protected FetcherNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetFetcherFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Projection.Type);
     PrivateSet   = true;
     Type         = new Type(NamesService.GetFetcherInterfaceName(odcmProperty.Projection.Type, odcmProperty.Projection));
 }
 protected ConcreteNavigationAccessorProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetPropertyFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     FieldType    = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type         = new Type(NamesService.GetConcreteTypeName(odcmProperty.Type));
 }
Exemplo n.º 3
0
 public static Class ForFetcherUpcastMethods(OdcmEntityClass odcmClass)
 {
     return(new Class
     {
         AccessModifier = "internal ",
         Identifier = NamesService.GetFetcherTypeName(odcmClass),
         Methods = global::Vipr.Writer.CSharp.Lite.Methods.ForFetcherUpcasts(odcmClass),
     });
 }
Exemplo n.º 4
0
 public static Field ForNavigationFetcherProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetFetcherFieldName(property),
         Type = property.IsCollection
              ? new Type(NamesService.GetCollectionTypeName((OdcmClass)property.Type))
              : new Type(NamesService.GetFetcherTypeName(property.Type))
     });
 }
Exemplo n.º 5
0
 private void Write(FetcherUpcastMethod method)
 {
     WriteSignature(method);
     using (_builder.IndentBraced)
     {
         _("var derivedFetcher = new {0}();", NamesService.GetFetcherTypeName(method.DerivedType));
         _("derivedFetcher.Initialize(this.Context, this.GetPath((string) null));");
         _("return ({0}) derivedFetcher;", NamesService.GetFetcherInterfaceName(method.DerivedType));
     }
 }
Exemplo n.º 6
0
 private void Write(CollectionGetByIdMethod method)
 {
     WriteSignature(method);
     using (_builder.IndentBraced)
     {
         _("return GetFetcherById<{0}, {1}>((i) => {2});", NamesService.GetConcreteTypeName(method.OdcmClass),
           NamesService.GetFetcherTypeName(method.OdcmClass),
           method.ParameterToPropertyMap.ToEquivalenceString("i"));
     }
 }
Exemplo n.º 7
0
        private void Write(FetcherExpandMethod method)
        {
            WriteSignature(method);
            using (_builder.IndentBraced)
            {
                _("return ({0}) new {1}()",
                  method.ReturnType.TypeIdentifier,
                  NamesService.GetFetcherTypeName(method.OdcmClass));

                using (_builder.IndentBraced)
                {
                    _("_query = this.EnsureQuery().Expand<TTarget>(navigationPropertyAccessor)");
                }
                _(";");
            }
        }
Exemplo n.º 8
0
 public static Class ForFetcher(OdcmClass odcmClass)
 {
     return(new Class
     {
         AccessModifier = "internal ",
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("RestShallowObjectFetcher")
                 : NamesService.GetFetcherTypeName(odcmClass.Base)),
         Constructors = global::Vipr.Writer.CSharp.Lite.Constructors.ForFetcher(odcmClass),
         Fields = global::Vipr.Writer.CSharp.Lite.Fields.ForFetcher(odcmClass),
         Identifier = NamesService.GetFetcherTypeName(odcmClass),
         Interfaces = global::Vipr.Writer.CSharp.Lite.ImplementedInterfaces.ForFetcherClass(odcmClass),
         Methods = global::Vipr.Writer.CSharp.Lite.Methods.ForFetcherClass(odcmClass),
         Properties = global::Vipr.Writer.CSharp.Lite.Properties.ForFetcher(odcmClass),
     });
 }
Exemplo n.º 9
0
        public static IEnumerable <Constructor> ForFetcher(OdcmClass odcmClass)
        {
            var classIdentifier = NamesService.GetFetcherTypeName(odcmClass);

            return(DefaultOnly(odcmClass, classIdentifier));
        }