visit Epsilon Minded Gregory Mazarakis | ... try and fail, but don't fail to try ...

in Brussel-Halle-Vilvoorde

by Gregory Mazarakis 30. April 2010 21:44

A friend of mine has just provided me a powerpoint presentation with a clear explanation on the problem for which politicians in Belgium keep on failing to find a solution. It is in Dutch...

 brussel-halle-vilvoorde.pps (728.00 kb)

Tags: ,

Personal Thoughts | politics

Entity Framework and many-to-many relations

by Gregory Mazarakis 22. April 2010 19:39

Yesterday I came across an issue in the Entity Framework that really frustrated me for a couple of hours. I decided to leave it in peace until I was able to think clearly again. Today I went back to tackle the issue and I was finally able to find a solution to my problem.

Issue

I have three tables in place, one describing a user account, one describing an in installation and finally on describing the relation between them. Both the UserAccount table and the Installation table have a primary key set on an identity column named after the table (UserAccountId and InstallationId). The identity column is set to increment with 1 step at the insert of a row. The UserAccountInstallation table provides the mapping between user accounts and installations:

image

no rocket science here… the issue now is that whenever I try to insert a new installation object into the database, I gracefully receive a System.Data.UpdateException exception, stating in the message:

A value shared across entities or associations is generated in more than one location. Check that mapping does not split an EntityKey to multiple server-generated columns.

Solution

It seems that Visual Studio 2010 RC causes the problem. When creating/refreshing an entity model in the visual studio IDE, the columns that are marked as identity columns in the database are given the attribute “StoreGeneratedPattern” with value “identity” in the mapping:

UserAccount 

<EntityType Name="UserAccount">
  <Key>
    <PropertyRef Name="UserAccountId" />
  </Key>
  <Property Name="UserAccountId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
  <Property Name="SyncServerId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
  <Property Name="Title" Type="nvarchar" MaxLength="8" />
  <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="50" />
  <Property Name="MiddleName" Type="nvarchar" MaxLength="50" />
  <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="50" />
  <Property Name="Suffix" Type="nvarchar" MaxLength="10" />
  <Property Name="Username" Type="nvarchar" Nullable="false" MaxLength="100" />
  <Property Name="CultureCode" Type="nvarchar" Nullable="false" MaxLength="5" />
  <Property Name="IsAdmin" Type="tinyint" Nullable="false" />
  <Property Name="NameStyle" Type="bit" Nullable="false" />
  <Property Name="EmailAddress" Type="nvarchar" MaxLength="50" />
  <Property Name="EmailPromotion" Type="tinyint" Nullable="false" />
  <Property Name="Phone" Type="nvarchar" MaxLength="25" />
  <Property Name="PasswordHash" Type="varchar" Nullable="false" MaxLength="128" />
  <Property Name="AccountNumber" Type="varchar" Nullable="false" MaxLength="10" StoreGeneratedPattern="Computed" />
  <Property Name="ModifiedDate" Type="datetime" Nullable="false" />
</EntityType>

Installation 

<EntityType Name="Installation">
  <Key>
    <PropertyRef Name="InstallationId" />
  </Key>
  <Property Type="Int32" Name="InstallationId" Nullable="false" a:StoreGeneratedPattern="Identity" xmlns:a="
http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
  <Property Type="String" Name="Identifier" Nullable="false" MaxLength="38" FixedLength="true" Unicode="false" />
  <Property Type="Byte" Name="IsActiveCode" Nullable="false" />
</EntityType>

UserAccountInstallation 

<EntityType Name="UserAccountInstallation">
  <Key>
    <PropertyRef Name="UserAccountId" />
    <PropertyRef Name="InstallationId" />
  </Key>
  <Property Name="UserAccountId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
  <Property Name="InstallationId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
</EntityType>

The issue is caused because the columns in the mapping table are also given the same attribute and value, resulting in the database trying to auto-increment a column that is not configured to do so! The solution is to dive into the XML representation of the entity model and remove the attribute from the properties where it is not applicable.

UserAccountInstallation 

<EntityType Name="UserAccountInstallation">
  <Key>
    <PropertyRef Name="UserAccountId" />
    <PropertyRef Name="InstallationId" />
  </Key>
  <Property Name="UserAccountId" Type="int" Nullable="false" />
  <Property Name="InstallationId" Type="int" Nullable="false" />
</EntityType>

Even further… my UserAccount table contains a reference to a another table that holds server configuration. This is a many-to-1 relationship as many user accounts can be member of the same server. The server is represented by its Id (auto-generated), in column SyncServerId… it seems that this column is also given the wrong attributes and I can fairly assume now that I will run again into the same issue when I try to include a new user account.

Is think the issue will be caused with every association created by the wizard where an endpoint is an identity column in a table.

In the mean time I found out that the problem is already brought to the attention of Microsoft: https://connect.microsoft.com/data/feedback/details/540058

Tags: , ,

Development | .net | issues

Trusting people

by Gregory Mazarakis 14. April 2010 08:28

I recently got another door slammed into my face…

I am certain that most of the readers will agree with me when I state that in our modern times I find it a challenge to create a business and an even bigger challenge to maintain one at a desired level. The markets are saturated, new ideas are rare and what we see is always a remake of an existing concept in a slightly different way. In the IT business things tend to evolve so rapidly… but again, most of the time we see existing concepts reappear providing more streamlined and efficient ways of use, in the form of a new version.

For a business to be successful today a good business plan must be in place with a clear vision, direction and strategy… and unfortunately a big portion of luck!

Having said that, I kept out one very tiny parameter to success, a parameter which value is so unpredictable that its success is again depended on pure luck. I am referring to the ability to trust other people, especially when a business is in a starting phase where not a lot of margin is available for error. For the past two years of my life I have committed much effort, time and energy to a specific cause that finally seemed to start paying off, in the form of a business proposition I received. The specifics of the business proposition are not important, what is important, though, is the fact that this proposition would never be presented if I did not earn the trust of the proposer, through the necessary commitment.

The proposition involved providing resources for a project at a fixed rate.

Immediately after receiving the proposition I contacted every qualifying candidate I knew to query availability at that time. I placed advertisements on job sites, organized job application meetings, made comparisons between at least fifteen profiles and finally narrowed my selection down to three people. To make a long story short, I met again with the remainder three people and decided which candidate was the most appropriate for the job. Everything seemed to go well; my client was also very much satisfied that I was able to provide feedback on such a short notice.

After I picked the appropriate candidate I faced two minor disadvantages, one of which would eventually lead to the deal going south. First of all, from my client’s perspective, the candidate was maybe a bit more social than expected, or let’s say, a little bit more open minded than expected. I felt that his character could lead to tensions because of his over-socializing and I-have-an-answer-for-everything attitude. Although that doesn’t bother me personally (as long as the job gets done) my client would not tolerate this on the long term. It would have become a challenge to find a balance, but I felt I was up to it. The second disadvantage was that the candidate was currently employed at another company. During our first meeting we made a gentleman’s agreement that he would resign from his current employer as from the moment I would confirm to him that he was hired by our company. During our sequel meeting I asked him: “how can I be certain that you will not do the same thing to our company, the way you are planning to do it to your current employer?”. He answered: “for me is honesty the most important thing. This is something I miss at my current employer”. I recognized the risk but I was convinced that the risk was worth it.

Because of these disadvantages I decided to move ahead very fast. The same evening after our sequel meeting I prepared the contracts and we signed them some time later on the same evening. It happened to be a Friday and I didn’t like the idea of letting it “hang” over the weekend. It was also much better for the candidate this way. He knew immediately were he stood Monday morning and he was able to take appropriate action in the form of a resignation at his current employer. Because he was only employed at that time under the terms of a temporary contract he was free to go seven days after he submitted his resignation.

On Wednesday I received an email from my candidate stating he did not had the intention to start working as agreed and that he preferred to continue working for his current employer. He stated that he had had several conversations with his employer and that his problems would be addressed and requirements would be met.

Of course I had made the necessary commitments to my client in the meantime. Hell, we had even created the necessary email accounts, login credentials, batch configuration for building access etc etc! I was devastated… I wished him all the best and immediately contacted the other candidates who (fortunately) were not yet informed that somebody else got the job, in an attempt to at least provide the service to my client that I committed to! Unfortunately, I couldn’t get it done any more on such a short notice. The technical profile of the remainder candidates was not satisfactory, except of that of a thirty year old guy. He told me on the phone that he had to discuss it with his mother and girlfriend prior committing (!!). I gave him a day to think about it, but I concluded that an unemployed person who still needs to discuss such an opportunity with nobody less than his mother, at the age of thirty, would probably not turn out to be what I was expecting. Can you believe that?

I lost the project...

I had a chance, recognized the risk but still grabbed it with both hands, counting on that one “tiny parameter for success”. I should have known better! People do rarely respect another person’s effort in a matter. I see this as a personal failure of mine and I will certainly be more careful in the feature. I feel like I have lost my client’s trust. I am disappointed in people in general at this point. How can somebody go through life in such a way? How can somebody expect to be respected, not for his technical skills but as a person in general?

I took legal action against him in the form of a damage claim. Here is a link to his blog so you can read his side of the story. His story is “Money grubbing World”. I placed an anonymous comment yesterday asking him whether he considered the damage he had caused to the company because of his immature behavior/actions and, sadly, I can see today that he “suddenly” refuses to post anonymous comments….

Do you think that taking legal action was too much? Please comment freely (and anonymously if you like Wink)

Tags: ,

Business | Personal Thoughts

4 weeks old...

by Gregory Mazarakis 3. July 2009 18:30

isn't it amaizing? 10 months ago you could only see him under a microscope...

20090621161116.wmv (2.87 mb)

you see... I am kind of busy these days so the technical articles are for after the summer!

Tags: ,

Childeren | Family

And then... there was life !!!

by Gregory Mazarakis 27. May 2009 03:38

That was the last text message I wrote and broadcasted to family and close friends... our son was born!

I am overwhelmed with feelings I never had in the past and the only thing I want to do is run on the streets and scream everything out! The feeling is so intense I don’t seem to be able to find the right way to deal with it…

One thing is sure… from now on I will go through life as a father to a child, as a protector of that new life, and as being grateful until the end of my days for this miracle that happened to me and my wife. Nothing is more important than this in life; everything else lost suddenly a lot of points on my scale of importance…

This is our heritage!!

Welcome Gerasime-Gregory to our world, I hope it will live up to your future expectations! I hope your dreams may come through as ours did the moment you were born…

 

Tags: ,

Family

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen

Gregory Says...

..."Find something you love to do and you'll never have to work a day in your life"...

Gregory Mazarakis

me...

Application/Solution Developer and Project Manager in a wide variety of business applications, driven by the need to obtain knowledge. Particularly interested in client/server applications, web applications and relational database design using MS-SQL Server or other products. Strong analytical and communication skills are pushing my career towards Project Management and a more abstract approach of the used technologies.

Mother tongue is Greek and Greece was, is and will always be one of my top passions. Other languages used on a daily basis are Dutch and English...

thank you for visiting!