Click here to Skip to main content
15,881,248 members
Articles / Hosted Services / Azure

Kerosene ORM: a dynamic, configuration-less and self-adaptive ORM for POCO objects supporting a SQL-like syntax from C#

Rate me:
Please Sign up or sign in to vote.
4.96/5 (71 votes)
1 Mar 2015CPOL35 min read 540.5K   4.6K   212  
The seventh version of the dynamic, configuration-less and self-adaptive Kerosene ORM library, that provides full real support for POCO objects, natural SQL-like syntax from C#, and advanced capabilities while being extremely easy to use.
// ======================================================== 
namespace Kerosene.ORM.Direct.Concrete
{
	using Kerosene.ORM.Core;
	using Kerosene.ORM.Core.Concrete;
	using Kerosene.Tools;
	using System;
	using System.Collections.Generic;
	using System.Data.Common;
	using System.Text;

	// ==================================================== 
	/// <summary>
	/// Represents the characteristics of a generic ORACLE database engine, and the factory to create specific objects
	/// adapted to it, in a direct connection scenario.
	/// </summary>
	public partial class KEngineOracleDirect : KEngineOracleBase, IKEngineDirect
	{
		/// <summary>
		/// Creates a new generic direct ORACLE database engine.
		/// </summary>
		/// <param name="invariantName">The case insensitive invariant name of this engine.</param>
		/// <param name="serverVersion">The server version or null if this information is not available.</param>
		/// <param name="caseSensitive">Whether the identifiers in the database can be case sensitive or not.</param>
		/// <param name="parameterPrefix">The default prefix to use when naming automatic parameters.</param>
		/// <param name="positionalParameters">Whether parameters are treated as positional ones instead of by name.</param>
		/// <param name="normalizedSkipTake"> Whether the dialect provides a normalized Skip/Take functionality or not.</param>
		public KEngineOracleDirect(
			string invariantName = "System.Data.OracleClient",
			string serverVersion = null,
			bool caseSensitive = true,
			string parameterPrefix = ":",
			bool positionalParameters = false,
			bool normalizedSkipTake = false)
			: base(invariantName, serverVersion, caseSensitive, parameterPrefix, positionalParameters, normalizedSkipTake) { }

		/// <summary>
		/// Returns a new instance that is a copy of this original one.
		/// </summary>
		public new KEngineOracleDirect Clone()
		{
			var cloned = new KEngineOracleDirect();
			OnClone(cloned, null); return cloned;
		}
		IKEngineDirect IKEngineDirect.Clone()
		{
			return this.Clone();
		}
		IKEngine IKEngine.Clone()
		{
			return this.Clone();
		}
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		/// <summary>
		/// Returns a new instance that initially was a copy of this original one, but that then afterwards its
		/// properties are modified using values of the matching entries in the settings dictionary, if any is
		/// given.
		/// </summary>
		/// <param name="settings">An optional dictionary containing entries with the names of the properties whose
		/// new values are obtained from the matching entries. The non-matching ones are just ignored.</param>
		public new KEngineOracleDirect Clone(Dictionary<string, object> settings)
		{
			var cloned = new KEngineOracleDirect();
			OnClone(cloned, settings); return cloned;
		}
		IKEngineDirect IKEngineDirect.Clone(Dictionary<string, object> settings)
		{
			return this.Clone(settings);
		}
		IKEngine IKEngine.Clone(Dictionary<string, object> settings)
		{
			return this.Clone(settings);
		}

		/// <summary>
		/// Returns the string representation of this instance.
		/// </summary>
		public override string ToString()
		{
			var str = base.ToString() + "::Direct";
			return str;
		}

		/// <summary>
		/// Gets the provider factory associated with this engine.
		/// </summary>
		public DbProviderFactory ProviderFactory
		{
			get { return DbProviderFactories.GetFactory(InvariantName); }
		}
	}
}
// ======================================================== 

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Spain Spain
mbarbac has worked in start-ups, multinational tech companies, and consulting ones, serving as CIO, CTO, SW Development Director, and Consulting Director, among many other roles.

Solving complex puzzles and getting out of them business value has ever been among his main interests - and that's why he has spent his latest 25 years trying to combine his degree in Theoretical Physics with his MBA... and he is still trying to figure out how all these things can fit together.

Even if flying a lot across many countries, along with the long working days that are customary in IT management and Consultancy, he can say that, after all, he lives in Spain (at least the weekends).

Comments and Discussions