public static FetcherNavigationProperty ForConcrete(OdcmProperty odcmProperty) { return new FetcherNavigationProperty(odcmProperty) { DefiningInterface = NamesService.GetFetcherInterfaceName(odcmProperty.Class) }; }
public static MockService SetupGetEntityProperty(this MockService mockService, EntityArtifacts targetEntity, IEnumerable<Tuple<string, object>> keyValues, OdcmProperty property) { return mockService .OnGetEntityPropertyRequest(targetEntity.Class.GetDefaultEntityPath(keyValues), property.Name) .RespondWithGetEntity(targetEntity.Class.GetDefaultEntitySetName(), targetEntity.Class.GetSampleJObject()); }
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 ObsoletedNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty) { Type = odcmProperty.IsCollection ? new Type(new Identifier("global::System.Collections.Generic", "IList"), new Type(NamesService.GetConcreteTypeName(odcmProperty.Type))) : new Type(NamesService.GetConcreteTypeName(odcmProperty.Type)); }
public new static ConcreteNavigationProperty ForConcrete(OdcmProperty odcmProperty) { return new ConcreteNavigationCollectionProperty(odcmProperty) { DefiningInterface = NamesService.GetConcreteInterfaceName(odcmProperty.Class), }; }
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))); }
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))); }
public static Parameter FromProperty(OdcmProperty arg) { return new Parameter { Name = arg.Name.ToLowerCamelCase(), Type = new Type(NamesService.GetConcreteTypeName(arg.Type)) }; }
public static Field ForConcreteNavigationCollectionProperty(OdcmProperty property) { return new Field { Name = NamesService.GetConcreteFieldName(property), Type = new Type(NamesService.GetExtensionTypeName("EntityCollectionImpl"), new Type(NamesService.GetConcreteTypeName((OdcmClass)property.Type))) }; }
public static Field ForFetcherNavigationCollectionProperty(OdcmProperty property) { return new Field { Name = NamesService.GetFetcherCollectionFieldName(property), Type = new Type(NamesService.GetCollectionTypeName((OdcmClass)property.Type)) }; }
public static Field ForNavigationProperty(OdcmProperty property) { return new Field { Name = NamesService.GetPropertyFieldName(property), Type = new Type(NamesService.GetConcreteTypeName(property.Type)) }; }
protected FetcherNavigationCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty) { CollectionType = new Type(NamesService.GetCollectionTypeName((OdcmClass)odcmProperty.Type)); FieldName = NamesService.GetFetcherCollectionFieldName(odcmProperty); InstanceType = NamesService.GetConcreteTypeName(odcmProperty.Type); Type = new Type(NamesService.GetCollectionInterfaceName((OdcmClass)odcmProperty.Type)); }
public ObsoletedProperty(OdcmProperty odcmProperty) : base(odcmProperty) { Type = odcmProperty.IsCollection ? new Type(new Identifier("global::System.Collections.Generic", "IList"), TypeService.GetPropertyType(odcmProperty)) : TypeService.GetPropertyType(odcmProperty); UpdatedName = Name; Name = NamesService.GetModelPropertyName(odcmProperty); }
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) }; }
public Given_an_OdcmClass_Entity_Complex_Structural_Property() { base.Init(m => { _structuralProperty = Any.ComplexOdcmProperty(m.Namespaces[0]); _structuralProperty.Class = Class; Class.Properties.Add(_structuralProperty); m.AddType(_structuralProperty.Type); }); _structuralPropertyType = Proxy.GetClass(_structuralProperty.Type.Namespace, _structuralProperty.Type.Name); }
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; }
public Given_an_OdcmClass_Service_Property_forced_to_pascal_case() { SetConfiguration(new CSharpWriterSettings { ForcePropertyPascalCasing = true }); base.Init(m => { _property = Model.EntityContainer.Properties.RandomElement(); _property = _property.Rename(Any.Char('a', 'z') + _property.Name); }); }
public Given_an_OdcmClass_Entity_Primitive_Structural_Property() { base.Init(m => { _structuralInstanceProperty = Any.PrimitiveOdcmProperty(p => p.Class = Class); _structuralCollectionProperty = Any.PrimitiveOdcmProperty(p => { p.Class = Class; p.IsCollection = true; }); Class.Properties.Add(_structuralInstanceProperty); Class.Properties.Add(_structuralCollectionProperty); }); }
public Given_an_OdcmClass_Entity_Navigation_Property_Instance_forced_to_pascal_case() { SetConfiguration(new CSharpWriterSettings { ForcePropertyPascalCasing = true }); Init(m => { _camelCasedProperty = Class.NavigationProperties().Where(p => !p.IsCollection).RandomElement(); _camelCasedName = Any.Char('a', 'z') + _camelCasedProperty.Name; _camelCasedProperty = _camelCasedProperty.Rename(_camelCasedName); }); _pascalCasedName = _camelCasedName.ToPascalCase(); }
public Given_an_OdcmClass_Complex_Property_forced_to_pascal_case() { SetConfiguration(new CSharpWriterSettings { ForcePropertyPascalCasing = true }); base.Init(m => { _targetClass = Any.ComplexOdcmClass(Namespace); m.AddType(_targetClass); _property = _targetClass.Properties.RandomElement(); _property = _property.Rename(Any.Char('a', 'z') + _property.Name); }); _targetType = Proxy.GetClass(_targetClass.Namespace, _targetClass.Name); }
public Given_an_OdcmClass_Entity_Property_forced_to_pascal_case() { SetConfiguration(new CSharpWriterSettings { ForcePropertyPascalCasing = true }); Init(m => { var originalProperty = Class.Properties.RandomElement(); var camelCasedName = Any.Char('a', 'z') + originalProperty.Name; _property = originalProperty.Rename(camelCasedName); }); _propertyType = Proxy.GetClass(_property.Type.Namespace, _property.Type.Name); if (_property.IsCollection) _propertyType = typeof (IList<>).MakeGenericType(_propertyType); }
public Given_a_nullable_Primitive_OdcmProperty() { _model = new OdcmModel(Any.ServiceMetadata()); _namespace = Any.EmptyOdcmNamespace(); _model.Namespaces.Add(_namespace); _class = Any.OdcmEntityClass(_namespace); _property = Any.PrimitiveOdcmProperty(p => { p.IsNullable = true; p.Class = _class; }); _class.Properties.Add(_property); _model.AddType(_class); }
private static string GetPascalCaseName(OdcmProperty property) { return property.Name.Substring(0, 1).ToUpper() + property.Name.Substring(1); }
protected ContainerNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty) { PrivateSet = true; }
public static ContainerNavigationProperty ForService(OdcmProperty odcmProperty) { return new ContainerNavigationProperty(odcmProperty); }
protected ContainerNavigationCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty) { }
public static OdcmProperty ComplexOdcmProperty(OdcmNamespace odcmNamespace, Action<OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = Any.ComplexOdcmClass(odcmNamespace) }; if (config != null) config(retVal); return retVal; }
private static OdcmProperty OdcmEntityProperty(OdcmClass @class, Action<OdcmProperty> config) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = @class }; if (config != null) config(retVal); return retVal; }
public static OdcmProperty PrimitiveOdcmProperty(Action<OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()) { Type = Any.PrimitiveOdcmType() }; if (config != null) config(retVal); return retVal; }
public static OdcmProperty OdcmProperty(Action<OdcmProperty> config = null) { var retVal = new OdcmProperty(Any.CSharpIdentifier()); if (config != null) config(retVal); return retVal; }