public FieldTypeMetaSafetyContainer(IFieldTypeMeta Template) { Type MetaType = Template.GetType(); Meta = (FieldTypeMetaBase)Activator.CreateInstance(MetaType); Meta.CopyValuesFrom((FieldTypeMetaBase)Template); }
internal void CopyValuesFrom(FieldTypeMetaBase OtherMeta) { if (OtherMeta == null) { throw new ArgumentNullException(nameof(OtherMeta)); } if (this.TenantID != OtherMeta.TenantID) { Log.Fatal("TenantID Does not match. FieldTypeMeta ID: {0}, OtherFieldTypeMetaID: {1}, This TenantID: {2}, other TenantID: {3}", this.FieldTypeMetaID, OtherMeta.FieldTypeMetaID, this.TenantID, OtherMeta.TenantID); throw new Exceptions.FatalException("Data error."); } this.FieldTypeMetaID = OtherMeta.FieldTypeMetaID; this.__IsRequired = OtherMeta.__IsRequired; this.TextRegex = OtherMeta.TextRegex; this.DecimalMin = OtherMeta.DecimalMin; this.DecimalMax = OtherMeta.DecimalMax; this.DateTimeMax = OtherMeta.DateTimeMax; this.DateTimeMin = OtherMeta.DateTimeMin; if (OtherMeta.IsRequiredQuery != null) { this.IsRequiredQuery = Configure.GetObjectQueryProvider(); this.IsRequiredQuery.QueryText = OtherMeta.IsRequiredQuery.QueryText; } }