Esempio n. 1
0
 protected ConcreteNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName  = NamesService.GetPropertyFieldName(odcmProperty);
     FieldType  = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type       = new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type));
     PrivateSet = true;
 }
Esempio n. 2
0
 public new static ConcreteNavigationProperty ForConcrete(OdcmProperty odcmProperty)
 {
     return(new ConcreteNavigationCollectionProperty(odcmProperty)
     {
         DefiningInterface = NamesService.GetConcreteInterfaceName(odcmProperty.Class),
     });
 }
 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))));
 }
Esempio n. 4
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)));
 }
Esempio n. 5
0
 private ConcreteNavigationCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName  = NamesService.GetConcreteFieldName(odcmProperty);
     OdcmType   = odcmProperty.Type;
     PrivateSet = true;
     Type       = new Type(new Identifier("global::System.Collections.Generic", "IList"),
                           new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)));
 }
Esempio n. 6
0
 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)));
 }
Esempio n. 7
0
        public static IEnumerable <Type> ForConcrete(OdcmClass odcmClass)
        {
            var retVal = new List <Type>
            {
                new Type(NamesService.GetConcreteInterfaceName(odcmClass)),
            };

            return(retVal);
        }
 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 CollectionRemoveLinkAsyncMethod(OdcmClass odcmClass)
 {
     Name       = "RemoveLinkAsync";
     Parameters = new[]
     {
         new Parameter(new Type(new Identifier("System", "Object")), "source"),
         new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "target"),
         new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "deferSaveChanges", "false")
     };
     ReturnType = new Type(Identifier.Task);
 }
Esempio n. 10
0
 private FetcherUpdateMethod(OdcmClass odcmClass)
 {
     Visibility = Visibility.Public;
     Name       = "UpdateAsync";
     Parameters = new[]
     {
         new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "item"),
         new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "deferSaveChanges", "false")
     };
     ReturnType = new Type(Identifier.Task);
     OdcmClass  = odcmClass;
 }
Esempio n. 11
0
        public CollectionAddAsyncMethod(OdcmClass odcmClass)
        {
            Name = "Add" + odcmClass.Name + "Async";

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

            ReturnType = new Type(Identifier.Task);
        }
Esempio n. 12
0
        public ContainerAddToCollectionMethod(OdcmProperty odcmProperty)
        {
            Name = "AddTo" + odcmProperty.Name;

            ModelCollectionName = odcmProperty.Name;

            Parameters = new[]
            {
                new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)), odcmProperty.Name.ToLowerCamelCase()),
            };

            ReturnType = Type.Void;
        }
Esempio n. 13
0
 private FetcherSetMethod(OdcmClass odcmClass)
 {
     Visibility = Visibility.Public;
     Name       = "SetAsync";
     Parameters = new[]
     {
         new Parameter(new Type(new Identifier("System", "Object")), "source"),
         new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "target"),
         new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "deferSaveChanges", "false")
     };
     ReturnType = new Type(Identifier.Task);
     OdcmClass  = odcmClass;
 }
Esempio n. 14
0
        public static IEnumerable <Type> ForConcreteInterface(OdcmClass odcmClass)
        {
            var retVal = new List <Type>();

            var baseClass = odcmClass.Base;

            if (baseClass != null)
            {
                retVal.Add(new Type(NamesService.GetConcreteInterfaceName(baseClass)));
            }

            return(retVal);
        }
Esempio n. 15
0
 public static Class ForCollection(OdcmEntityClass odcmClass)
 {
     return(new Class
     {
         AccessModifier = "internal ",
         BaseClass = new Type(NamesService.GetExtensionTypeName("QueryableSet"),
                              new Type(NamesService.GetConcreteInterfaceName(odcmClass))),
         Constructors = global::Vipr.Writer.CSharp.Lite.Constructors.ForCollection(odcmClass),
         Interfaces = global::Vipr.Writer.CSharp.Lite.ImplementedInterfaces.ForCollectionClass(odcmClass),
         Identifier = NamesService.GetCollectionTypeName(odcmClass),
         Methods = global::Vipr.Writer.CSharp.Lite.Methods.ForCollectionClass(odcmClass),
         Indexers = global::Vipr.Writer.CSharp.Lite.Indexers.ForCollection(odcmClass)
     });
 }
Esempio n. 16
0
        private void Write(ConcreteNavigationCollectionProperty property)
        {
            WriteDeclaration(property);

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

                using (_builder.IndentBraced)
                {
                    _("return {0}.Cast<{1}>().ToList();", property.Name, NamesService.GetConcreteInterfaceName(property.OdcmType));
                }
            }
        }
Esempio n. 17
0
        public static IEnumerable <Interface> ForConcrete(OdcmClass odcmClass)
        {
            var @interface = new Interface
            {
                Attributes  = global::Vipr.Writer.CSharp.Lite.Attributes.ForConcreteInterface,
                Identifier  = NamesService.GetConcreteInterfaceName(odcmClass),
                Description = odcmClass.Description,
                Namespace   = NamesService.GetNamespaceName(odcmClass.Namespace),
                Properties  = global::Vipr.Writer.CSharp.Lite.Properties.ForConcreteInterface(odcmClass),
                Interfaces  = global::Vipr.Writer.CSharp.Lite.ImplementedInterfaces.ForConcreteInterface(odcmClass)
            };

            return(new List <Interface>()
            {
                @interface
            });
        }
Esempio n. 18
0
        public AddAsyncMediaMethod(OdcmClass odcmClass)
        {
            Name = "Add" + odcmClass.Name + "Async";

            Parameters = new[]
            {
                new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "item"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("IStream")), "stream"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("String")), "contentType"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "deferSaveChanges", "false"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "closeStream", "false")
            };

            ReturnType = new Type(Identifier.Task);

            Visibility = ConfigurationService.Settings.MediaEntityAddAsyncVisibility;
        }
Esempio n. 19
0
 private FetcherExpandMethod(OdcmClass odcmClass, OdcmProjection projection = null)
 {
     Visibility        = Visibility.Public;
     Name              = "Expand";
     GenericParameters = new[] { "TTarget" };
     Parameters        = new[]
     {
         new Parameter(new Type(new Identifier("System.Linq.Expressions", "Expression"),
                                new Type(new Identifier("System", "Func"), new Type(NamesService.GetConcreteInterfaceName(odcmClass)),
                                         new Type(new Identifier(null, "TTarget")))), "navigationPropertyAccessor"),
     };
     ReturnType = new Type(NamesService.GetFetcherInterfaceName(odcmClass, projection));
     OdcmClass  = odcmClass;
 }
Esempio n. 20
0
        public static IEnumerable <Interface> ForCollection(OdcmEntityClass odcmClass)
        {
            var interfaces = new List <Interface>();

            foreach (var projection in odcmClass.DistinctProjections())
            {
                var @interface = new Interface
                {
                    Attributes = global::Vipr.Writer.CSharp.Lite.Attributes.ForCollectionInterface,
                    Identifier = NamesService.GetCollectionInterfaceName(odcmClass, projection),
                    Namespace  = NamesService.GetNamespaceName(odcmClass.Namespace),
                    Methods    = global::Vipr.Writer.CSharp.Lite.Methods.ForCollectionInterface(odcmClass, projection),
                    Indexers   = IndexerSignature.ForCollectionInterface(odcmClass, projection),
                    Interfaces = new[] { new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSetBase"), new Type(NamesService.GetConcreteInterfaceName(odcmClass))) }
                };

                interfaces.Add(@interface);
            }

            return(interfaces);
        }