diff Source/DataAccess/DataAccessorTA.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/DataAccess/DataAccessorTA.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,47 @@
+using BLToolkit.Data;
+using BLToolkit.TypeBuilder;
+
+namespace BLToolkit.DataAccess
+{
+	public abstract class DataAccessor<T,TA> : DataAccessor<T>
+		where TA : DataAccessor<T>
+	{
+		#region Constructors
+
+		[System.Diagnostics.DebuggerStepThrough]
+		protected DataAccessor()
+		{
+		}
+
+		[System.Diagnostics.DebuggerStepThrough]
+		protected DataAccessor(DbManager dbManager)
+			: base(dbManager)
+		{
+		}
+
+		#endregion
+
+		#region CreateInstance
+
+		public static TA CreateInstance()
+		{
+			return TypeFactory.CreateInstance<TA>();
+		}
+
+		public static TA CreateInstance(DbManager dbManager)
+		{
+			return CreateInstance(dbManager, false);
+		}
+
+		public static TA CreateInstance(DbManager dbManager, bool dispose)
+		{
+			TA da = TypeFactory.CreateInstance<TA>();
+
+			da.SetDbManager(dbManager, dispose);
+
+			return da;
+		}
+
+		#endregion
+	}
+}