protected ConcreteNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty) { FieldName = NamesService.GetPropertyFieldName(odcmProperty); FieldType = NamesService.GetConcreteTypeName(odcmProperty.Type); Type = new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)); PrivateSet = true; }
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)))); }
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 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))); }
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))); }
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); }
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; }
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); }
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; }
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; }
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); }
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) }); }
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)); } } }
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 }); }
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; }
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; }
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); }