From 2d4a4d5f7ed6845765a09db5c372a3dc684db57d Mon Sep 17 00:00:00 2001 From: Railz Date: Wed, 10 Apr 2019 23:07:12 +0200 Subject: [PATCH] Changed DbForeignObject no longer needing the Type --- Database-Attribute_System/Attributes/DbForeignObject.cs | 9 ++++----- .../Database-Attribute_System.csproj | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) 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