Beispiel #1
0
 public static Attribute ForLowerCaseProperty()
 {
     return(new Attribute
     {
         Type = new Type(NamesService.GetExtensionTypeName("LowerCasePropertyAttribute"))
     });
 }
        public void Write(OdcmMethod odcmMethod)
        {
            var returnType = NamesService.GetPublicTypeName(odcmMethod.ReturnType);

            var parameters = string.Join(", ",
                                         (from i in odcmMethod.Parameters select NamesService.GetPublicTypeName(i.Type, i.IsCollection) + " " + i.Name));
        }
 protected FetcherNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName    = NamesService.GetFetcherFieldName(odcmProperty);
     InstanceType = NamesService.GetFetcherTypeName(odcmProperty.Type);
     PrivateSet   = true;
     Type         = new Type(NamesService.GetFetcherInterfaceName(odcmProperty.Type));
 }
 public static FetcherExpandMethod ForConcrete(OdcmClass odcmClass)
 {
     return(new FetcherExpandMethod(odcmClass)
     {
         DefiningInterface = NamesService.GetFetcherInterfaceName(odcmClass)
     });
 }
 public new static FetcherNavigationProperty ForConcrete(OdcmProperty odcmProperty)
 {
     return(new FetcherNavigationCollectionProperty(odcmProperty)
     {
         DefiningInterface = NamesService.GetFetcherInterfaceName(odcmProperty.Class),
     });
 }
 public static ConcreteNavigationProperty ForConcrete(OdcmProperty odcmProperty)
 {
     return(new ConcreteNavigationProperty(odcmProperty)
     {
         DefiningInterface = NamesService.GetConcreteInterfaceName(odcmProperty.Class),
     });
 }
Beispiel #7
0
 private void Write(ConcreteUpcastMethod method)
 {
     WriteSignature(method);
     using (_builder.IndentBraced)
     {
         _("return ({0}) this;", NamesService.GetFetcherInterfaceName(method.DerivedType));
     }
 }
 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));
 }
Beispiel #9
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)))
     });
 }
Beispiel #10
0
 public static Field ForNavigationCollectionProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetFetcherCollectionFieldName(property),
         Type = new Type(NamesService.GetCollectionTypeName((OdcmClass)property.Type))
     });
 }
Beispiel #11
0
 private ConcreteNavigationCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName  = NamesService.GetConcreteFieldName(odcmProperty);
     OdcmType   = odcmProperty.Type;
     PrivateSet = true;
     Type       = new Type(NamesService.GetExtensionTypeName("IPagedCollection"),
                           new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)));
 }
Beispiel #12
0
 public static Field ForNavigationProperty(OdcmProperty property)
 {
     return(new Field
     {
         Name = NamesService.GetPropertyFieldName(property),
         Type = new Type(NamesService.GetConcreteTypeName(property.Type))
     });
 }
Beispiel #13
0
 public CollectionExecuteAsyncMethod(OdcmClass odcmClass)
 {
     Name       = "ExecuteAsync";
     Parameters = Parameter.Empty;
     ReturnType = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                           new Type(NamesService.GetExtensionTypeName("IPagedCollection"),
                                    new Type(NamesService.GetConcreteInterfaceName(odcmClass))));
 }
 public EnsureQueryMethod(OdcmClass odcmClass)
 {
     IsPublic         = false;
     Name             = "EnsureQuery";
     FetchedType      = NamesService.GetPublicTypeName(odcmClass);
     QueryableSetType = new Type(NamesService.GetExtensionTypeName("ReadOnlyQueryableSet"), new Type(NamesService.GetPublicTypeName(odcmClass)));
     ReturnType       = new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSet"), new Type(NamesService.GetConcreteInterfaceName(odcmClass)));
 }
Beispiel #15
0
 public static Parameter FromProperty(OdcmProperty arg)
 {
     return(new Parameter
     {
         Name = arg.Name.ToLowerCamelCase(),
         Type = new Type(NamesService.GetConcreteTypeName(arg.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)));
 }
Beispiel #17
0
 public static IEnumerable <Property> ForEntityContainer(OdcmClass odcmContainer)
 {
     return(Properties.ForEntityContainerInterface(odcmContainer)
            .Concat(new Property[]
     {
         new AutoProperty("Context", new Type(NamesService.GetExtensionTypeName("DataServiceContextWrapper")),
                          privateSet: true)
     }));
 }
 public ConcreteExecuteAsyncMethod(OdcmType odcmType)
 {
     EntityIdentifier  = NamesService.GetConcreteInterfaceName(odcmType);
     DefiningInterface = NamesService.GetFetcherInterfaceName(odcmType);
     Name       = "ExecuteAsync";
     Parameters = Parameter.Empty;
     ReturnType = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                           new Type(NamesService.GetConcreteInterfaceName(odcmType)));
 }
 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)));
 }
 public FetcherExecuteAsyncMethod(OdcmClass odcmClass)
 {
     IsAsync      = true;
     IsOverriding = odcmClass.Base is OdcmClass && !((OdcmClass)odcmClass.Base).IsAbstract;
     Name         = "ExecuteAsync";
     Parameters   = Parameter.Empty;
     ReturnType   = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                             new Type(NamesService.GetConcreteInterfaceName(odcmClass)));
 }
Beispiel #21
0
 public void Write(OdcmEnum odcmEnum)
 {
     // if no Underlying type is specified then default to 'int'.
     _("public enum {0} : {1}", odcmEnum.Name,
       odcmEnum.UnderlyingType == null ? "int" : NamesService.GetPrimitiveTypeKeyword(odcmEnum.UnderlyingType));
     using (_builder.IndentBraced)
     {
         Write(odcmEnum.Members);
     }
 }
Beispiel #22
0
        public static IEnumerable <Type> ForConcrete(OdcmClass odcmClass)
        {
            var retVal = new List <Type>
            {
                new Type(NamesService.GetConcreteInterfaceName(odcmClass)),
                new Type(NamesService.GetFetcherInterfaceName(odcmClass))
            };

            return(retVal);
        }
Beispiel #23
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));
     }
 }
Beispiel #24
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)
     });
 }
Beispiel #25
0
 public static Interface ForEntityContainer(OdcmClass odcmContainer)
 {
     return(new Interface
     {
         Identifier = NamesService.GetEntityContainerInterfaceName(odcmContainer),
         Interfaces = null,
         Methods = global::CSharpWriter.Methods.ForEntityContainerInterface(odcmContainer),
         Properties = global::CSharpWriter.Properties.ForEntityContainerInterface(odcmContainer),
         Namespace = odcmContainer.Namespace
     });
 }
Beispiel #26
0
 public static Interface ForConcrete(OdcmClass odcmClass)
 {
     return(new Interface
     {
         Identifier = NamesService.GetConcreteInterfaceName(odcmClass),
         Methods = global::CSharpWriter.Methods.ForConcreteInterface(odcmClass),
         Namespace = odcmClass.Namespace,
         Properties = global::CSharpWriter.Properties.ForConcreteInterface(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForConcreteInterface(odcmClass)
     });
 }
Beispiel #27
0
        public AddAsyncMethod(OdcmClass odcmClass)
        {
            Name = "Add" + odcmClass.Name + "Async";

            Parameters = new[]
            {
                new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "item"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "dontSave", "false")
            };

            ReturnType = new Type(Identifier.Task);
        }
Beispiel #28
0
 public static Interface ForCollection(OdcmClass odcmClass)
 {
     return(new Interface
     {
         Attributes = new[] { Attribute.ForLowerCaseProperty() },
         Identifier = NamesService.GetCollectionInterfaceName(odcmClass),
         Namespace = odcmClass.Namespace,
         Methods = global::CSharpWriter.Methods.ForCollectionInterface(odcmClass),
         Indexers = IndexerSignature.ForCollectionInterface(odcmClass),
         Interfaces = new[] { new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSetBase"), new Type(NamesService.GetConcreteInterfaceName(odcmClass))) }
     });
 }
Beispiel #29
0
 public static Interface ForFetcher(OdcmClass odcmClass)
 {
     return(new Interface
     {
         Attributes = new[] { Attribute.ForLowerCaseProperty() },
         Identifier = NamesService.GetFetcherInterfaceName(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForFetcherInterface(odcmClass),
         Methods = global::CSharpWriter.Methods.ForFetcherInterface(odcmClass),
         Namespace = odcmClass.Namespace,
         Properties = global::CSharpWriter.Properties.ForFetcherInterface(odcmClass)
     });
 }
Beispiel #30
0
        private void Write(OdcmNamespace @namespace)
        {
            _("namespace {0}", NamesService.GetNamespaceName(@namespace));
            using (_builder.IndentBraced)
            {
                Write(_dependencies);

                Write(@namespace.Enums);

                Write(@namespace.Classes);
            }
        }