diff --git a/Database-Attribute_System/Attributes/DbForeignObject.cs b/Database-Attribute_System/Attributes/DbForeignObject.cs index 5045304..dd058f7 100644 --- a/Database-Attribute_System/Attributes/DbForeignObject.cs +++ b/Database-Attribute_System/Attributes/DbForeignObject.cs @@ -9,7 +9,7 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System.Attributes [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] public class DbForeignObject : Attribute { - public Type _foreignObjectType; + public Type foreignObjectType; public string _foreignKeyName; public DbForeignKey foreignKeyAttribute; @@ -20,11 +20,9 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System.Attributes /// /// Marks variable as foreign-object of an dbObject /// - /// Type of foreignObject /// Fieldname of foreignKey associated with the foreignObject - public DbForeignObject(Type foreignObjectType, string foreignKeyName = null) + public DbForeignObject(string foreignKeyName = null) { - this._foreignObjectType = foreignObjectType; this._foreignKeyName = foreignKeyName; } @@ -32,9 +30,10 @@ namespace eu.railduction.netcore.dll.Database_Attribute_System.Attributes { this.parentField = fi; this.classAttribute = classAttribute; + this.foreignObjectType = fi.GetType(); // Init foreign-object class - DbObject foreignClassAttribute = ClassAction.Init(this._foreignObjectType); + DbObject foreignClassAttribute = ClassAction.Init(this.foreignObjectType); // Check if something is weird if (foreignClassAttribute.primaryKeyAttributes.Count < 1) throw new InvalidOperationException($"'{foreignClassAttribute.parentClassType.Name}' does not have a primaryKey."); diff --git a/Database-Attribute_System/Database-Attribute_System.csproj b/Database-Attribute_System/Database-Attribute_System.csproj index 24e3b55..b49c8e1 100644 --- a/Database-Attribute_System/Database-Attribute_System.csproj +++ b/Database-Attribute_System/Database-Attribute_System.csproj @@ -4,7 +4,7 @@ netcoreapp2.1 eu.railduction.netcore.dll.Database_Attribute_System false - 1.5 + 1.5.1