protected FetcherNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetFetcherFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     PrivateSet   = true;
     Type         = new Type(NamesService.GetFetcherInterfaceName(odcmProperty.Type));
 }
 protected FetcherNavigationCollectionProperty(OdcmProperty odcmProperty)
     : base(odcmProperty)
 {
     CollectionType = new Type(NamesService.GetCollectionTypeName((OdcmClass)odcmProperty.Type));
     FieldName      = NamesService.GetFetcherCollectionFieldName(odcmProperty);
     InstanceType   = NamesService.GetFetcherTypeName(odcmProperty.Type);
     Type           = new Type(NamesService.GetCollectionInterfaceName((OdcmClass)odcmProperty.Type));
 }
Example #3
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));
     }
 }
Example #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))
     });
 }
Example #5
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::CSharpWriter.Constructors.ForFetcher(odcmClass),
         Fields = global::CSharpWriter.Fields.ForFetcher(odcmClass),
         Identifier = NamesService.GetFetcherTypeName(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForFetcher(odcmClass),
         Methods = global::CSharpWriter.Methods.ForFetcher(odcmClass),
         Properties = global::CSharpWriter.Properties.ForFetcher(odcmClass),
     });
 }
Example #6
0
        private void Write(CollectionGetByIdIndexer indexer)
        {
            WriteSignature(indexer);
            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("var path = GetPath((i) => {0});", indexer.ParameterToPropertyMap.ToEquivalenceString("i"));
                    _("var fetcher = new {0}();", NamesService.GetFetcherTypeName(indexer.OdcmClass));
                    _("fetcher.Initialize(Context, path);");
                    _("");
                    _("return fetcher;");
                }
            }
        }
Example #7
0
        private void Write(FetcherExpandMethod method)
        {
            WriteSignature(method);
            using (_builder.IndentBraced)
            {
                if (method.DefiningInterface == null)
                {
                    _("return ({0}) new {1}()",
                      NamesService.GetFetcherInterfaceName(method.OdcmClass),
                      NamesService.GetFetcherTypeName(method.OdcmClass));

                    using (_builder.IndentBraced)
                    {
                        _("_query = this.EnsureQuery().Expand<TTarget>(navigationPropertyAccessor)");
                    }
                    _(";");
                }
                else
                {
                    _("return ({0}) this;", NamesService.GetFetcherInterfaceName(method.OdcmClass));
                }
            }
        }
Example #8
0
        public static IEnumerable <Constructor> ForFetcher(OdcmClass odcmClass)
        {
            var classIdentifier = NamesService.GetFetcherTypeName(odcmClass);

            return(DefaultOnly(odcmClass, classIdentifier));
        }
 protected ConcreteNavigationAccessorProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetPropertyFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     Type         = new Type(NamesService.GetConcreteTypeName(odcmProperty.Type));
 }