Click here to Skip to main content
15,896,063 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 548.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
{
	using Kerosene.ORM.Core;
	using System;
	using System.Data;

	// ==================================================== 
	/// <summary>
	/// Represents a direct connection or data context against an arbitrary underlying database, and acts as a
	/// factory to create specific objects adapted to it.
	/// </summary>
	public interface IKLinkDirect : IKLink
	{
		/// <summary>
		/// Returns a new instance that is a copy of this original one.
		/// </summary>
		new IKLinkDirect Clone();

		/// <summary>
		/// Gets the engine that describes the characteristics of the underlying database this instance is associated
		/// with.
		/// </summary>
		new IKEngineDirect Engine { get; }

		/// <summary>
		/// Gets the transaction instance created for this link.
		/// </summary>
		new IKTransactionDirect Transaction { get; }

		/// <summary>
		/// Gets or sets the actual connection string this link will use.
		/// <para>The setter accepts the actual connection string or the connection entry name to locate it.</para>
		/// </summary>
		string ConnectionString { get; set; }

		/// <summary>
		/// Gets (if possible) the server identification from the connection string.
		/// </summary>
		string Server { get; }

		/// <summary>
		/// Gets (if possible) the database identification from the connection string.
		/// </summary>
		string Database { get; }

		/// <summary>
		/// Gets the actual underlying connection in use by this link, or null if no connection has been created yet or if
		/// it has been closed.
		/// </summary>
		IDbConnection Connection { get; }

		/// <summary>
		/// Factory method to create an enumerator for the given command.
		/// <para>If the command's link is not the same as this one an exception is thrown.</para>
		/// </summary>
		/// <param name="command">The command.</param>
		new IKEnumeratorDirect CreateEnumerator(IKEnumerable command);

		/// <summary>
		/// Factory method to create an executor for the given command.
		/// <para>If the command's link is not the same as this one an exception is thrown.</para>
		/// </summary>
		/// <param name="command">The command.</param>
		new IKExecutorDirect CreateExecutor(IKExecutable command);
	}
}
// ======================================================== 

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