public IConfigurationItem ResolveComplexPropertyItem() { IComplexProperty complexProperty = _container.Resolve(typeof(IComplexProperty)) as IComplexProperty; complexProperty.NumberOfPoints = 1; return(complexProperty); }
public IEditorConfigurationItemViewModel VisitComplexProperty(IComplexProperty property) { var res = _container.Resolve <IComplexPropertyEditorViewModel>(); res.ChildStructItemViewModels.Clear(); res.NumberOfPoints = "1"; if (property == null) { InitializeBaseProperties(res, property); return(res); } res.IsGroupedProperty = property.IsGroupedProperty; foreach (ISubProperty subProperty in property.SubProperties) { var subPropertyViewModel = subProperty.Accept(this.WithParent(res)); (subPropertyViewModel as ISubPropertyEditorViewModel).BitNumbersInWord = res.MainBitNumbersInWordCollection; foreach (var bitNumber in subProperty.BitNumbersInWord) { var sharedBit = (subPropertyViewModel as ISubPropertyEditorViewModel).BitNumbersInWord .First((viewModel => viewModel.NumberOfBit == bitNumber)); sharedBit.Refresh(); sharedBit.ChangeValueByOwnerCommand ?.Execute(subPropertyViewModel); } res.SubPropertyEditorViewModels.Add(subPropertyViewModel as ISubPropertyEditorViewModel); res.ChildStructItemViewModels.Add(subPropertyViewModel as ISubPropertyEditorViewModel); res.IsCheckable = true; } InitializeProperty(res, property); return(res); }
private static ClassDefinition BuildClassDefinition(IComplexProperty property, string ns, string className) { ClassDefinition definition = new ClassDefinition(); List <ClassPropertyDefinition> classProperties = new List <ClassPropertyDefinition>(); HashSet <string> usingNamespaces = new HashSet <string>(); foreach (var dataEntityProperty in property.ComplexPropertyType.Properties) { var entityProperty = (DynamicProperty)dataEntityProperty; usingNamespaces.Add(entityProperty.PropertyType.Namespace); string annotation = entityProperty.Name; if (string.IsNullOrWhiteSpace(annotation)) { annotation = entityProperty.Name; } classProperties.Add( new ClassPropertyDefinition() { Name = entityProperty.Name, Annotation = annotation, TypeName = GetBaseTypeName(entityProperty.PropertyType) }); } return(definition.SetAnnotation(property.Name).SetName(className).SetNamespace(ns).SetProperties(classProperties).SetUsingNamespaces(usingNamespaces)); }
public override ICodeBehindEntity Generate(IComplexProperty complexProperty) { Type propertyType = complexProperty.Entity.FieldType; Type genericType = typeof(WpfCodeBehindEntity <>).MakeGenericType(propertyType); var codeBehindEntity = (ICodeBehindEntity)Activator.CreateInstance(genericType, complexProperty.Entity.Name); Filter(codeBehindEntity, complexProperty); return(codeBehindEntity); }
private bool ReadComplexProperty(IComplexProperty property, object entity) { if (property == null) { return(false); } string action = GetAttributeValue(this._reader, "action", "edit"); this.DoComplexPropertyAction(action, property, entity); return(true); }
public static IEnumerable <IComplexProperty> GetComplexProperties(this IDataEntityPropertyCollection properties, bool onlyDbProperty = true) { for (int i = 0; i < properties.Count; i++) { IDataEntityProperty metadata = properties[i]; IComplexProperty iteratorVariable0 = metadata as IComplexProperty; if ((iteratorVariable0 != null) && (!onlyDbProperty || !metadata.IsDbIgnore())) { yield return(iteratorVariable0); } } }
private void DoComplexPropertyAction(string action, IComplexProperty property, object entity) { string str2 = action; if (str2 != null) { if (!(str2 == "edit")) { if (str2 == "setnull") { property.SetValue(entity, null); goto Label_00E4; } } else { string name = this._reader.Name; bool isEmptyElement = false; isEmptyElement = this._reader.IsEmptyElement; if (!isEmptyElement) { isEmptyElement = !this.MoveToNextElement(name); } if (!isEmptyElement) { object obj2 = property.GetValue(entity); object objB = this.ReadElement(property.ComplexPropertyType, obj2); if (!property.IsReadOnly && !object.ReferenceEquals(obj2, objB)) { property.SetValue(entity, objB); } this.MoveToNextElement(name); } else if (!property.IsReadOnly) { property.SetValue(entity, null); } goto Label_00E4; } } SerializationException.SerializationExceptionData data = new SerializationException.SerializationExceptionData { CanIgnore = true }; this.ThrowXmlException("??????", string.Format(ResManager.LoadKDString("不能识别的属性操作符{0}", "014009000001742", SubSystemType.SL, new object[0]), action), data, null); Label_00E4: this.SafeDo(); }
public Result VisitComplexProperty(IComplexProperty property) { return(VisitProperty(property)); }
public abstract ICodeBehindEntity Generate(IComplexProperty complexProperty);
protected void Filter(ICodeBehindEntity codeBehindEntity, IComplexProperty complexProperty) { //some filtering logic on codeBehindEntity.Handlers and Properties, to get rid of unnecessary //filtering based on constraints, FODF, LFFF etc from complexProperty }