I have written another ORM: customorm.codeplex.com

November 29, 2011 Uncategorized 5 comments

Yes, that’s truth. World now has yet another ORM system written in .NET. Again someone (me) reinvented the wheel. Why?
Before you started abusing me, let me provide you with some insight.

Of course there was need for this ORM to be born

I’ve been working with NHibernate for manner of couple of years. I would say team got used to it. Few months ago we’ve got challenge to integrate some of our code with legacy system. It is written in Delphi, but exposes some .NET stuff. Underlying data provider was legacy cache system (relational) covered with Delphi and bit exposed in .NET, also cache was capable of switching to SQLServer when in connected mode. When we decided to integrate our system with this legacy code we had to come up with solution that utilizes existing WCF (!) entities for mapping, solution that can call legacy code with correct select sql statements depending on connect mode and can handle update/insert/delete for the object graphs utilizing legacy interfaces.

Long story short, we ended very much with these three methods. Some other methods are also available, but I’m showing this for more rush:

object InsertUpdateRow(string tblName, IEnumerable fields, IEnumerable fldsValues, IEnumerable keyFlds);
void DeleteRow(string tblName, IEnumerable fieldsList, IEnumerable fieldsValues, IEnumerable keyFields);
DataTable SelectSQL(string selectSql);
This doesn’t look like exposing a lot of possibilities. We had option to go with naked SQL, than mapping from DataTables to entities reading data with DataReader. And all manual. Isn’t it boring and too-oo-oo much code?

It is fun to work on ORM, so why not take it further

For me it was really nice work to make that whole reflection and data access working smoothly. So I tried to have my code as much abstract as I can so it can be isolated somehow from that legacy and separated code for my personal project very early. Some of the features I had to recode at work, some at home. Instead of “IntegrationDataAccess” I wrote simple AdoDataAccess over mine IDataAccess and got it more or less completed.

I think it is part of my learning curve, to write this project. I’m learning what it means to start something open source, how to use yet another source control. Playing with hardcore reflection and other not-business logic code is real fun.

Another thing why I would like to make it open to the world and not mine home-hidden project is being exposed to more job opportunities. When you are at interview you often have no code to show, because all you’ve written is production and you signed papers forbidding you to show that code.

So… here it is – CustomORM

CustomORM is tiny ORM system written in .NET. CORM is slightly bigger than so-called micro-ORMs and much smaller than NHibernate. It has its uniqueness.

Features at glance:

  • POCO (real POCO without any “virtual” constraints or attributes)
  • Mapping much like FluentNH
  • Very light, thus faster
  • No syntaxes to learn (nothing like complex criteria or another version of sql)
  • Source code in your project you can debug, and change quickly

Now, let me show you some code

Sample fetch

Here is how select works:
           Criteria criteria = CreateCriteria(typeof(Customer), "c")
                .AddEntity(typeof(Order), "o")
                .AddEntity(typeof(Employee), "e")
                        @"left join Orders o
                        on c.[Customer ID] = o.[Customer ID]
                        left join Employees e
                        on e.[Employee ID] = o.[Employee ID]
                        where c.[Customer ID] = @customerId")
                .AddParameter("@customerId", customerId);

            List<Customer> customers = ExecuteCriteria<Customer>(criteria);
As you can see you add type of entity to take part in join, assign alias to it and then write old known SQL. In the end you get nice collection of objects. No root transformations to be applied.

Sample save

Here is code you might write for the save:
        public Customer SaveCustomer(Customer customer)
            var transaction = BeginTransaction();

            Customer savedCustomer = null;
                savedCustomer = Save(customer);
            catch (Exception)
            return savedCustomer;


All this above will work after small setup and mappings for your objects.
    class CustomerMap : EntityToTableMapper<Customer>
        public CustomerMap()
            Id(x => x.CustomerID, "Customer ID")
            Map(x => x.CompanyName, "Company Name");
            Map(x => x.ContactName, "Contact Name");
            Map(x => x.ContactTitle, "Contact Title");
            Map(x => x.City, "City");
            HasMany(x => x.Orders, "Customer ID");

Get started code

To get started all setup you need is basically two things: derive you own Repository class from RepositoryBase and add bootstrap code at start of your app similar to this:
// Let CORM know where your mappings live and that's mostly it

// Initialize AdoDataAccess or (advanced) implement your own IDataAcces 
var s = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"];
var ceDataAccess = new AdoDataAccess(s.ConnectionString, s.ProviderName);

// You are ready to use you repository, it already has Fetch<T>, Save, Delete 
var customerRepository = new CustomerRepository(ceDataAccess);
Hope it doesn’t look like much code.

What is at codeplex now and what’s next?

As for now I have CRUD operations tested on Northwind SqlCe database. I verified that fetching 91 customers (2000 db records) is 2-3 times faster than NHibernate.

Project still lacks very much in transactions/sessions/concurrency and completely doesn’t have caching (I don’t think it should ever have).

Project has bad code coverage and probably isn’t ready for community review until I polish it. But anyway sharing this with you because someone has to kick-me-off.

If you still would like to take a look at some code please start with CustomORM.Examples => Program for usage code and for engine code go to CustomORM where most of the heavy logic lives in RepositoryBase and EntityToTableMapper.

Depending on feedback and my mood I will decide if it worth investing more of mine time or not.


My 200th blog post. Sometimes it is hard to blog.

August 22, 2011 Uncategorized No comments

Hello. Officially this is my 200th blog post.

In my “100th blog post” I wrote that blogging pays off and indeed it brought me many cool things, like knowledge, opportunities, also I became noticeable by others in my company.

In that hundred posts I finished my series on design patters. I prepared for being senior developer and became him. I delivered many presentations, including one big it-jam. I wrote few popular posts on career plan and interviews. I had many other not less interesting posts.

It took me 9 months to have those first 100 posts and now I see that next portion took me over year. Interesting… when will I get my 300th post. Would it take year, less, or more? I cannot answer, but I know that blogging started to be hard for me. Not because I don’t have things to blog about, but because I don’t stop myself for few moments to write about something. Almost each day I have some challenges at work, I can blog about. I read many interesting stuff, which I can try out and blog about. But I don’t.

I know, I know real blogger shouldn’t write such posts. And I wouldn’t even try to convince anyone that I’ve been very busy or something… I had lot of routine stuff that many people have all their life. I had nothing unusual but for some reason lost feeling of the road I’ve decided to take. Why did I?

I have disease – I often think that I will do the stuff later, maybe in the evening or tomorrow. And when I think so I do nothing next day. It is damn stupid habit. For the dozen of weeks I thought that I will post latest 2 design patterns, but I did not. Some time passed and I had them on my blog, but it was too hard.

Why do I think that I will do all the stuff tomorrow? It is not possible. There are guys at work that never think that way. They are so much responsible, they fill that cannot left working place until some good portion of their job is done. WTF? Why I don’t have such skill?

I probably didn’t read my blog for some long time! I need to! Here is something that gives me some advices on how I should proceed.

Where have I been? Nothing is going to be tomorrow if I do nothing today!


No comments

I spoke again about DDD at Lviv JUG

November 5, 2010 Uncategorized 4 comments

Here in Lviv we have awesome Java User Group and yesterday I had chance to speak there and again about DDD. So I probably have nothing to add about presentation itself. Presentation has only this icon on the top as a difference:


But I have something to add about the group itself and performance. Group is slightly different from .NET one. It is smaller – about 15 people were listening to me. But guys in group have much more solid experience in developing software. They all are in their late 20th and some in 30th I guess. They ask slightly another scope of questions. All of the them know how to build complex software and they know a lot of design patterns. That is why I guess listening about DDD was not something special and absolutely new for them, since I see DDD as some (new) set of (existing) design patterns and (existing) approaches to build software starting from model.

After my presentation, very enthusiastic person Zenyk talked about one of the approaches of using Amazon could. For me it was very interesting and exciting, since it was first time I’ve heard about more or less complete solutions based on many Amazon services.

BTW, Zenyk does great job on keeping software developers community site, all in Ukrainian:


Group is not sponsored by Oracle, as .NET group is sponsored by Microsoft. They do not have that many presents, but they do their best in keeping their own library of books.

Looking forward to hear from guys, who listened to me.


What the hack is NuPack

October 17, 2010 Uncategorized No comments


NuPack is package manager for .NET introduced to help developers easily work with 3rd party libraries.

Here is great post on NuPack, I would recommend to read.

But as I promised in twitter to have blog post called “What the hack is NuPack”, I need to post this.

So,… downloading…


After it get downloaded and installed, we have one additional menu item in same place where we do have “add reference”:


So what does “Add Package Reference” do?

It takes a look on the feed for packages, where you see 3rd party you can add. On the picture below I just added AutoMapper, by clicking “Install”.


I can easily search for other components and install them. On the picture below I easily searched for my favorite ORM – Nhibernate and installed it. But if you ever worked with it you know that it depends on few other 3rd party, such as log4net, etc. Great news! They all get installed automatically.


Physically it puts config file within your project and locate all your components under folder ”packages” along with your solution file, like below:


After that I got interested to know how it behaves with couple of solutions all in SAME folder, and figured out that it works just fine – it puts everything into same folder.

Everywhere I read about nupack they all declare that it is solution related, so I have one folder for solution. But as you may know I work with enterprise project and we keep all 3rd party in separate location where dozen (20-30) solutions are looking for references. And it looks that I do not have possibility to configure NuPack to put “packages” folder in another place. Or I’m missing something. Please let me know.

EDITED (Oct 17, 11:39PM): I already got an answer for my question:


So to shortly summarize:

NuPack allows you easily fetch whole range of different 3rd party components and momentarily add references to your projects without need to manually go and download them, then unpack and reference. Also NuPack allows you easily manage all of your components, allowing you update them and do other cool stuff. Go and check it out!

No comments

Is this blog succeeding? Some statistics

October 17, 2010 Uncategorized 2 comments

I guess all bloggers know about such things as Google Analytics and Feedburner. But if you are not blogger, in few words those are statistics engines analyzing site’s visits. I’m keeping eye on statistics and here just want to share some information and thank you all.

Here is where from you all guys are:


Just another more deterministic representation of the same information:


Sadly, but I turned on Google Analytics only in the end of this summer, so pictures above do not represent whole life-time of my blog.

But feedburner states following about my Subscribers:

I have 30 readers on average for the whole time of existing of this blog. Most recent average numbers are near 50.


Also accordingly to feedburner I have:

  • 4,940 views of 97 items
  • 3,008 clicks back to the site on 105 items

Also I have 256 comments.

All of this shows me that my blog is getting more popular and it continues paying me back…

Thank you all guys for interest in this blog. I will do my best to keep it up and running by posting high quality content and the most needed information to help us reach success in this epoch of software development.


Andriy Buday List of Podcasts for .NET Programmers

August 2, 2010 Uncategorized No comments

I listen to few tech podcasts, which talk on programming. I fill with them my time, when getting to the work or traveling somewhere. So no time lost :) Also except of getting good valuable information I sharpen my English. For folk who it trying to reach success in software development it is very important.

So here is my list of podcasts I listen to. Please note, it will not be comprehensive list of podcasts, since I do not listen to all. If you want to see more comprehensive list proceed with this link where Scott Hanselman mentioned his list along with links to lists of other folks.

This is amazing podcast. Besides it brings great content it is also very fun stuff. Carl and Richard talk easily, they interview lot of interesting people. These guys might be surprised that someone wrote “.NET ROCKS” on his body being in mountains far from in Ukraine…

Continuation of the list (I might add more comments in future):

Hearding code
Deep Fried Bytes
Software engineering radio
Elegant Code
Chanel 9

This Developers Life

Let me know which of the listed you also listen and which would you recommend for me.

No comments

First Blog Post or why did I start this?

October 10, 2009 Uncategorized 1 comment


I’m still a student, but I already started to work for one really dedicated company. The company made me very pragmatic. I found that there are people who want to get to the success and there are others who are not so keen to work hard.

I’m not one of those lazy and goalless guys. After reading a couple of books on success (Robert Kiosaki, Bodo Scheffer, Napoleon Hill) and after realizing that at the same moment my company started to develop our own certification model for Developers, I found a target for myself in my life.

When employee gets a promotion, usually there was hard word toward it. And this is what I got to do in the middle of Spring 2009. I was promoted to Intermediate Developer, after working 11 months as Junior Developer.

My next target is to became Senior Developer before I get my Master Diploma. You could say that my company is unwise if it will promote you or that my University is bad as it allows me to work at the time when I’m studying. What I would say is: I’m pragmatic and this is my way to Success, so I will broke any wall you will put on my way.

First purpose of this blogging is to have place where I can put my Developer founds, investigations, thoughts on different technologies, etc.

Second purpose it to help you in your findings over Internet. I know that google knows all, but  google doesn’t know things that only particular persons discovered and did not post it somewhere. I will be posting my founds so google will know more.

I hope this will help you and me!


1 comment