// TODO: removed ValidSince /** * @param fields * A List of <code>Field</code> objects * @param type * type is a string and one of "friend", "family", "work", * "other" * @param subtype * `subtype` is a string and is not restricted to a specific list * of possible values (for example, if type_ is "family" then * subtype can be "Father", "Mother", "Son" and many other * things). */ public Relationship(IEnumerable<Field> fields = null, RelationshipTypes? type = null, string subtype = null) : base(fields) { this.Type = type; this.Subtype = subtype; }
public PropertyInfo <T> Create <T>(Type type, string name, string friendlyName, T defaultValue, RelationshipTypes relationship) { return(new PropertyInformationUsingOriginalValue <T>(name, friendlyName, defaultValue, relationship)); }
/// <summary> /// Indicates that the specified property belongs /// to the business object type. /// </summary> /// <typeparam name="P">Type of property</typeparam> /// <param name="propertyLambdaExpression">Property Expression</param> /// <param name="friendlyName">Friendly description for a property to be used in databinding</param> /// <param name="defaultValue">Default Value for the property</param> /// <param name="relationship">Relationship with /// referenced object.</param> /// <returns></returns> protected static PropertyInfo <P> RegisterProperty <P>(Expression <Func <T, object> > propertyLambdaExpression, string friendlyName, P defaultValue, RelationshipTypes relationship) { PropertyInfo reflectedPropertyInfo = Reflect <T> .GetProperty(propertyLambdaExpression); return(RegisterProperty(reflectedPropertyInfo.Name, friendlyName, defaultValue, relationship)); }
protected static PropertyInfo <P> RegisterProperty <P>(Expression <Func <T, object> > propertyLambdaExpression, string friendlyName, RelationshipTypes relationship) { PropertyInfo reflectedPropertyInfo = Reflect <T> .GetProperty(propertyLambdaExpression); return(RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create <P>(typeof(T), reflectedPropertyInfo.Name, friendlyName, relationship))); }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="relationship">Relationship with referenced object.</param> public PropertyInfo(string name, RelationshipTypes relationship) : this(name, string.Empty) { _relationshipType = relationship; }
public static PropertyInfo <T> Register <TTarget, T>(Expression <Func <TTarget, object> > propertyLambdaExpression, RelationshipTypes relationship) { var property = new PropertyInfo <T>( Reflect <TTarget> .GetProperty(propertyLambdaExpression).Name, relationship); return(BusinessBase.RegisterProperty <T>(typeof(TTarget), property)); }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="relationship">Relationship with referenced object.</param> public PropertyInfo(string name, RelationshipTypes relationship) : this(name, null, null, DataBindingFriendlyDefault(), relationship) { }
/// <summary> /// Indicates that the specified property belongs /// to the business object type. /// </summary> /// <typeparam name="P">Type of property</typeparam> /// <param name="propertyName">Property name from nameof()</param> /// <param name="relationship">Relationship with property value.</param> /// <returns></returns> protected static PropertyInfo<P> RegisterProperty<P>(string propertyName, RelationshipTypes relationship) { return RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create<P>(typeof(T), propertyName, string.Empty, relationship)); }
public PropertyInformationUsingOriginalValue(Type containingType, string name, string friendlyName, T defaultValue, RelationshipTypes relationship) : base(name, friendlyName, defaultValue, relationship) { this.ContainingType = containingType; }
/// <summary> /// Creates a new instance of PropertyInfo. /// </summary> /// <param name="containingType"> /// Type of business class that contains the property /// declaration. /// </param> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="defaultValue"> /// Default value for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public Csla.PropertyInfo <T> Create <T>(Type containingType, string name, string friendlyName, T defaultValue, RelationshipTypes relationship) { return(new Csla.PropertyInfo <T>(name, friendlyName, containingType, defaultValue, relationship)); }
public PropertyInfo <T> Create <T>(Type containingType, string name, string friendlyName, RelationshipTypes relationship) { return(new PropertyInformationUsingOriginalValue <T>(containingType, name, friendlyName, relationship)); }
/// <summary> /// Creates a new instance of PropertyInfo. /// </summary> /// <param name="containingType"> /// Type of business class that contains the property /// declaration. /// </param> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public Csla.PropertyInfo <T> Create <T>(Type containingType, string name, string friendlyName, RelationshipTypes relationship) { if (string.IsNullOrWhiteSpace(friendlyName)) { friendlyName = GetFriendlyNameFromAttributes(containingType, name); } return(new Csla.PropertyInfo <T>(name, friendlyName, relationship)); }
/// <summary> /// Creates a new instance of PropertyInfo. /// </summary> /// <param name="containingType"> /// Type of business class that contains the property /// declaration. /// </param> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public Csla.PropertyInfo <T> Create <T>(Type containingType, string name, string friendlyName, RelationshipTypes relationship) { return(new Csla.PropertyInfo <T>(name, friendlyName, containingType, PropertyInfo <T> .DataBindingFriendlyDefault(), relationship)); }
/// <summary> /// Creates a new instance of PropertyInfo. /// </summary> /// <param name="containingType"> /// Type of business class that contains the property /// declaration. /// </param> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="defaultValue"> /// Default value for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public Csla.PropertyInfo <T> Create <T>(Type containingType, string name, string friendlyName, T defaultValue, RelationshipTypes relationship) { #if WINDOWS_PHONE if (string.IsNullOrEmpty(friendlyName)) #else if (string.IsNullOrWhiteSpace(friendlyName)) #endif { friendlyName = GetFriendlyNameFromAttributes(containingType, name); } return(new Csla.PropertyInfo <T>(name, friendlyName, defaultValue, relationship)); }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="containingType"> /// Factory to provide display name from attributes. /// </param> /// <param name="defaultValue"> /// Default value for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public PropertyInfo(string name, string friendlyName, Type containingType, T defaultValue, RelationshipTypes relationship) { Name = name; _friendlyName = friendlyName; _relationshipType = relationship; if (containingType != null) { _propertyInfo = containingType.GetProperty(Name); } // if T is string we need an empty string, not null, for data binding if (typeof(T).Equals(typeof(string)) && defaultValue == null) { _defaultValue = (T)((object)string.Empty); } else { _defaultValue = defaultValue; } }
public void Init(string id, string reltype) { RelType = reltype; IndexClientId = id; AddPersonLabel = $"Register New {RelType}"; RelationshipTypes = _lookupService.GetRelationshipTypes().ToList().Where(x => x.Description.ToLower() == RelType.ToLower()).ToList(); if (!string.IsNullOrEmpty(RelType)) { _settings.AddOrUpdateValue("RelType", RelType); } if (!string.IsNullOrEmpty(RelType)) { _settings.AddOrUpdateValue("rIndexClientId", IndexClientId); } if (!string.IsNullOrEmpty(RelType)) { _settings.AddOrUpdateValue("AddPersonLabel", AddPersonLabel); } if (RelationshipTypes.ToList().Count > 0) { _settings.AddOrUpdateValue("RelationshipTypes", JsonConvert.SerializeObject(RelationshipTypes.ToList())); } }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="relationship">Relationship with referenced object.</param> public PropertyInfo(string name, RelationshipTypes relationship) : this(name, null, null, default(T), relationship) { }
private static TRelation[] FilterRelationsByType <TRelation>(IQueryable <PersonRelationship> relations, RelationshipTypes type) where TRelation : class { return (( from rel in relations where rel.RelationshipTypeId == (int)type select typeof(TRelation) == typeof(PersonRelationType) ? rel.ToPersonRelationType() as TRelation : rel.ToPersonFlerRelationType() as TRelation ).ToArray()); }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="containingType"> /// Factory to provide display name from attributes. /// </param> /// <param name="defaultValue"> /// Default value for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public PropertyInfo(string name, string friendlyName, Type containingType, T defaultValue, RelationshipTypes relationship) { Name = name; _friendlyName = friendlyName; _relationshipType = relationship; if (containingType != null) { _propertyInfo = containingType.GetProperty(Name); } _defaultValue = defaultValue; }
private static PersonRelationship[] ListFromXmlType(PersonFlerRelationType[] oio, RelationshipTypes relType) { if (oio != null) { return(oio.AsQueryable() .Where(r => r != null) .Select( r => new PersonRelationship() { CommentText = r.CommentText, Effect = Effect.FromVirkningType(r.Virkning), PersonRelationshipId = Guid.NewGuid(), RelatedPersonUuid = new Guid(r.ReferenceID.Item), RelationshipTypeId = (int)relType } ) .ToArray()); } return(new PersonRelationship[0]); }
public void SetRelationship(Name principalModel, IEnumerable <Name> principalFields, Name dependantModel, IEnumerable <Name> dependantFields, RelationshipTypes principalType = RelationshipTypes.One, RelationshipTypes dependantType = RelationshipTypes.Many, string?linkTable = null) { if (principalFields is null) { throw new ArgumentNullException(nameof(principalFields)); } if (dependantFields is null) { throw new ArgumentNullException(nameof(dependantFields)); } PrincipalModel = principalModel ?? throw new ArgumentNullException(nameof(principalModel)); DependantModel = dependantModel ?? throw new ArgumentNullException(nameof(dependantModel)); PrincipalFields.AddRange(principalFields); DependantFields.AddRange(dependantFields); PrincipalType = principalType; DependantType = dependantType; LinkTable = PrincipalType == RelationshipTypes.Many && DependantType == RelationshipTypes.Many && string.IsNullOrWhiteSpace(linkTable) ? principalModel.Value + dependantModel.Value : linkTable; }
/// <summary> /// Defines a data relationship. /// </summary> /// <param name="relationType"></param> public RelationshipAttribute(RelationshipTypes relationType) { RelationType = relationType; }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="defaultValue"> /// Default value for the property. /// </param> /// <param name="relationship">Relationship with /// referenced object.</param> public PropertyInfo(string name, string friendlyName, T defaultValue, RelationshipTypes relationship) : this(name, friendlyName, defaultValue) { _relationshipType = relationship; }
/// <summary> /// Defines a data relationship. /// </summary> /// <param name="entityType">The type of the child entity.</param> /// <param name="relationType">The relationship type can be "One" or "Many".</param> public RelationshipAttribute(Type entityType, RelationshipTypes relationType) { EntityType = entityType; RelationType = relationType; }
/// <summary> /// Indicates that the specified property belongs /// to the business object type. /// </summary> /// <typeparam name="P">Type of property</typeparam> /// <param name="propertyLambdaExpression">Property Expression</param> /// <param name="relationship">Relationship with /// referenced object.</param> /// <returns></returns> protected static PropertyInfo <P> RegisterProperty <P>(Expression <Func <T, object> > propertyLambdaExpression, RelationshipTypes relationship) { PropertyInfo reflectedPropertyInfo = Reflect <T> .GetProperty(propertyLambdaExpression); return(RegisterProperty <P>(reflectedPropertyInfo.Name, relationship)); }
/// <summary> /// Indicates that the specified property belongs /// to the business object type. /// </summary> /// <typeparam name="P">Type of property</typeparam> /// <param name="propertyName">Property name from nameof()</param> /// <param name="friendlyName">Friendly description for a property to be used in databinding</param> /// <param name="defaultValue">Default Value for the property</param> /// <param name="relationship">Relationship with /// referenced object.</param> /// <returns></returns> protected static PropertyInfo <P> RegisterProperty <P>(string propertyName, string friendlyName, P defaultValue, RelationshipTypes relationship) { return(RegisterProperty(Csla.Core.FieldManager.PropertyInfoFactory.Factory.Create <P>(typeof(T), propertyName, friendlyName, defaultValue, relationship))); }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="friendlyName"> /// Friendly display name for the property. /// </param> /// <param name="containingType"> /// Factory to provide display name from attributes. /// </param> /// <param name="relationship">Relationship with referenced object.</param> public PropertyInfo(string name, string friendlyName, Type containingType, RelationshipTypes relationship) : this(name, friendlyName, null, DataBindingFriendlyDefault(), relationship) { }
public static Model AddRelation(this Model model, string[] principalFields, string dependant, string[] dependantFields, RelationshipTypes principalType, RelationshipTypes dependantType, string?linkTable) { model.Relationships.Add(new Relationship() { PrincipalFields = principalFields.Select(f => new Name(f)).ToList(), PrincipalModel = model.Name, PrincipalType = principalType, DependantFields = dependantFields.Select(f => new Name(f)).ToList(), DependantModel = new Name(dependant), DependantType = dependantType, LinkTable = linkTable }); return(model); }