public virtual void UiBtnCommandUpAction(Object param) { if ((ForeignKeyPropertiesIndex > 0) && (ForeignKeyPropertiesIndex < ForeignKeyProperties.Count)) { ForeignKeyProperties.Move(ForeignKeyPropertiesIndex, ForeignKeyPropertiesIndex - 1); } }
public virtual void UiBtnCommandDownAction(Object param) { if ((ForeignKeyPropertiesIndex > -1) && (ForeignKeyPropertiesIndex < ForeignKeyProperties.Count - 1)) { ForeignKeyProperties.Move(ForeignKeyPropertiesIndex, ForeignKeyPropertiesIndex + 1); } }
public void OnSelectedEntityChanged() { ForeignKeyPropertiesIndex = -1; EntityPropertiesIndex = -1; EntityProperties.Clear(); ForeignKeyProperties.Clear(); }
public virtual void UiBtnCommandToForeignAction(Object param) { if ((EntityPropertiesIndex > -1) && (EntityPropertiesIndex < EntityProperties.Count)) { var itm = EntityProperties[EntityPropertiesIndex]; if (!ForeignKeyProperties.Contains(itm)) { ForeignKeyProperties.Add(itm); } } }
public virtual void UiBtnCommandFromForeignAction(Object param) { if ((ForeignKeyPropertiesIndex > -1) && (ForeignKeyPropertiesIndex < ForeignKeyProperties.Count)) { ForeignKeyProperties.RemoveAt(ForeignKeyPropertiesIndex); if (ForeignKeyProperties.Count <= ForeignKeyPropertiesIndex) { if (ForeignKeyPropertiesIndex > -1) { ForeignKeyPropertiesIndex -= 1; } } } }
public void CollectEntityScalarProperties() { ForeignKeyProperties.Clear(); ForeignKeyPropertiesIndex = -1; EntityProperties.Clear(); EntityPropertiesIndex = -1; if (SelectedEntity == null) { return; } if (SelectedEntity.CodeElementRef == null) { return; } (SelectedEntity.CodeElementRef as CodeClass). CollectCodeClassAllMappedScalarProperties(EntityProperties); }
private void SetProperties(Type type) { foreach (PropertyInfo property in Properties) { ManagedProperties.Add(property.Name, property); FilteredProperties.Add(property.Name, property); foreach (CustomAttributeData attribute in property.CustomAttributes) { switch (attribute.AttributeType.Name) { case nameof(UnmanagedProperty): UnmanagedProperties.Add(property.Name, property); ManagedProperties.Remove(property.Name); FilteredProperties.Remove(property.Name); break; case nameof(AutoProperty): AutoProperties.Add(property.Name, property); AutoPropertyAttributes.Add(property.Name, property.GetCustomAttribute <AutoProperty>()); FilteredProperties.Remove(property.Name); break; case nameof(PrimaryKey): PrimaryKeyProperty = property; break; case nameof(DateCreated): DateCreatedProperty = property; AutoProperties.Add(property.Name, property); AutoPropertyAttributes.Add(property.Name, new AutoProperty(AutoPropertyTypes.DateTime)); FilteredProperties.Remove(property.Name); break; case nameof(DateModified): DateModifiedProperty = property; AutoProperties.Add(property.Name, property); AutoPropertyAttributes.Add(property.Name, new AutoProperty(AutoPropertyTypes.DateTime)); FilteredProperties.Remove(property.Name); break; case nameof(ForeignKey): ForeignKeyProperties.Add(property.Name, property); ForeignKeyAttributes.Add(property.Name, property.GetCustomAttribute <ForeignKey>()); break; case nameof(Unique): UniqueKeyProperties.Add(property.Name, property); break; case nameof(Default): DefaultProperties.Add(property.Name, property); DefaultAttributes.Add(property.Name, property.GetCustomAttribute <Default>()); break; case nameof(DataLength): DataLengthProperties.Add(property.Name, property); DataLengthAttributes.Add(property.Name, property.GetCustomAttribute <DataLength>()); break; case nameof(ForeignData): ForeignDataProperties.Add(property.Name, property); ForeignDataAttributes.Add(property.Name, ConfigureForeignDataAttribute(property.GetCustomAttribute <ForeignData>(), property)); ManagedProperties.Remove(property.Name); FilteredProperties.Remove(property.Name); break; default: break; } } } PerformPropertiesValidation(type); }
public virtual void UiBtnCommandAllFromForeignAction(Object param) { ForeignKeyProperties.Clear(); ForeignKeyPropertiesIndex = -1; }
public void DoRefresh() { if (EntityNonScalarPropertiesIndex < 0) { return; } if (EntityNonScalarProperties.Count <= EntityNonScalarPropertiesIndex) { return; } if (SelectedEntity == null) { return; } if (SelectedEntity.CodeElementRef == null) { return; } string navigationName = EntityNonScalarProperties[EntityNonScalarPropertiesIndex]; CodeClass dbContext = null; if (SelectedDbContext != null) { if (SelectedDbContext.CodeElementRef != null) { dbContext = SelectedDbContext.CodeElementRef as CodeClass; } } List <FluentAPIForeignKey> frnKeys = (SelectedEntity.CodeElementRef as CodeClass).CollectForeignKeys(dbContext, new List <string> { navigationName }); if (frnKeys == null) { ErrorsText = "No Fk detected"; return; } if (frnKeys.Count < 1) { ErrorsText = "No Fk detected"; return; } string className = (SelectedEntity.CodeElementRef as CodeClass).Name; if (frnKeys[0].HasErrors) { ErrorsText = frnKeys[0].ErrorsText; } else { ErrorsText = null; } IsCascadeOnDelete = frnKeys[0].IsCascadeDelete; if (frnKeys[0].EntityName == className) { string navName = frnKeys[0].InverseNavigationName; if (PrincipalNonScalarProperties != null) { FluentAPINavigationProperty np = PrincipalNonScalarProperties.FirstOrDefault(p => p.PropName == navName); if (np != null) { PrincipalNonScalarPropertiesIndex = PrincipalNonScalarProperties.IndexOf(np); } else { PrincipalNonScalarPropertiesIndex = -1; } } ForeignKeyProperties.Clear(); if ((frnKeys[0].ForeignKeyProps != null) && (EntityProperties != null)) { foreach (FluentAPIProperty itm in frnKeys[0].ForeignKeyProps) { FluentAPIExtendedProperty currItm = EntityProperties.FirstOrDefault(i => i.PropName == itm.PropName); if (currItm != null) { ForeignKeyProperties.Add(currItm); } } } ForeignKeyTypesIndex = ForeignKeyTypes.IndexOf(frnKeys[0].NavigationType); } else { PrincipalNonScalarPropertiesIndex = -1; ForeignKeyProperties.Clear(); } }
public void OnSelectedDbContextChanged() { ForeignKeyPropertiesIndex = -1; ForeignKeyProperties.Clear(); }