public void CreatePropertyAssignment(PropertyAssignment propertyAssignment) { if (this._disposed == true) { return; } if (this.PropertyAssignments.Contains(propertyAssignment) == false) { this.PropertyAssignments.Add(propertyAssignment); } }
public IRegistration WithPropertyValue(Type component, string propertyName, object value) { var node = (from match in this._kernel.Nodes where match.Component == component select match).FirstOrDefault(); if (node == null) { return(this); } if (string.IsNullOrEmpty(propertyName) == false) { var propertyType = component.GetProperty(propertyName).PropertyType; var assignment = new PropertyAssignment(component, propertyType, propertyName, value); node.CreatePropertyAssignment(assignment); } return(this); }
public IRegistration WithPropertyValue <TComponent>(Expression <Func <TComponent, object> > property, object value) { var node = (from match in this._kernel.Nodes where match.Component == typeof(TComponent) || match.Contract == typeof(TComponent) select match).FirstOrDefault(); if (node == null) { return(this); } var propertyName = GetPropertyName <TComponent>(property); var propertyType = typeof(TComponent).GetProperty(propertyName).PropertyType; var assignment = new PropertyAssignment(typeof(TComponent), propertyType, propertyName, value); node.CreatePropertyAssignment(assignment); return(this); }