Entity Framework Code First Approach (How to make a property Unique)

So when do you want to do this ?

So the you have a database table property that you need to make unique and you are creating and updating your database through entityframework using a code first approach .

Entity Frame work doesnt have an inbuilt unique annotation so you will need to get around this issue heres how you would do that

The example below :

  1. So firstly extend your context to DbContext
  2. Download Nuget Package Fluent API
    Install-Package FluentValidation -Version 8.4.0
  3. Then in your context create an extension called
    1.  protected override OnModelCreating(ModelBuilder modelBuilder)
  4. Within add the following lines
    1. modelBuilder.Entity<Person>()
       .HasIndex(c => c.DepartmentNumber ).IsUnique();
  5. After you run this and migrate and update the db . This column will have a unique constraint on this key meaning you wont be able to create duplicates of this value
  6. From My example I am creating a Persons Table with a seeded Person already my primary key is PersonId and my unique index is DepartmentNumber
  7. Hope this is some help to some one else
    public class RepositoryContext : DbContext
            public RepositoryContext(DbContextOptions options)
                : base(options)
            /// <summary>
            // Since Im using .Net Core will be using Fluent API
            // so that I can we can make DepartmentNumber a unique constraint on the DB
            // link : https://docs.microsoft.com/en-us/ef/core/modeling/relational/unique-constraints
            /// Seeding the Data here with the data provided
            /// </summary>
            /// <param name="modelBuilder"></param>
            protected override void OnModelCreating(ModelBuilder modelBuilder)
                    .HasIndex(c => c.DepartmentNumber ).IsUnique();
                    new Person
                        Name = "Ivo Robotnik",
                        PersonId = Guid.NewGuid(),
                        Title = "Doctor",
                        Department = "Family",
                        DepartmentNumber = "US0378331005",
            public DbSet<Company> Persons { get; set; }

How to do Dependency Injection With Azure Web Job using Ninject

So here I going to write up how to do Dependency Injection using Ninject with a Azure Queue Trigger web job.

So Firstly we have to create our Azure WebJob so right click on the solution

  • Add new web job project
  • Capture
  • After you have added we are going to NuGet and install the Ninject Package
    • Install-Package Ninject -Version 3.3.4
    • Next Create a new folder called JobActivator
    • Once the folder is created ,Then create the JobActivator.cs
using Microsoft.Azure.WebJobs.Host;

using Ninject;

namespace WebJob.JobActivator


publicclass JobActivator : IJobActivator


privatereadonly IKernel _container;

public JobActivator(IKernel container)


_container = container;


public T CreateInstance<T>()


return _container.Get<T>();



  • Once you created this go your Program.cs . Now we will set up the Dependency Injection .
  • So next create another folder called Bindings
  • You Next need to create a BindingModule to Ninject Module
  • I am using a mock Test Class which does nothing
using Ninject.Modules;

namespace WebJob.Bindings


publicclass BindingModule : NinjectModule


publicoverridevoid Load()





using System.Configuration;
using Microsoft.Azure.WebJobs;
using Ninject;

namespace WebJob
class Program

// Please set the following connection strings in app.config
// for this WebJob to run:

// AzureWebJobsDashboard and AzureWebJobsStorage

static void Main()

//Set up DI

var kernel = new StandardKernel(module);

//This the Storage Credentials for your Azure Storage Account 
var storageConnectionString = 

var config = new JobHostConfiguration(storageConnectionString) 
//This is where we passed the Job Activator 
JobActivator = new JobActivator.JobActivator(kernel)
if (config.IsDevelopment)

//Pass configuration to JobJost

var host = new JobHost(config);

// The following code ensures that the WebJob will be running continuously




Now you can go your Functions class use your injected classes as see below

using System.IO;
using Microsoft.Azure.WebJobs;

namespace WebJob

publicclass Functions

private readonly ITestclass _testClass;

public Functions(ITestclass testClass)

_testClass= testClass;


// This function will get triggered/executed when a new message is written

// on an Azure Queue called queue.

public void ProcessQueueMessage([QueueTrigger("QueueMessage")] 
  string message, TextWriter log)



  • As you can see above now can use your injected classes without it throwing errors.

When to use iFrames from Parent to Child Communctions?

So currenly I am looking into iFrames and how to pass information to and from parent to child , but through all my searching I dont really find where and when you should do this . Maybe someone alot smarter than me can point me towards the right path.

But interestly enough I have seen one example of it and why it should be used . So the real life example is a company that deals with securing credit card payments that doesnt not want to share out an api endpoint to its service to the outside world or their client and wants to do the validation on the card on their internal system and return a response from that .

How it validates the card and secures the card information is not too relevant for this conversation .

But this iFrame after submit on the form returns back a  jsonObject if it failed or succeeded it goes back to the parent and you as the client can deal with the response as you see fit .

So the reason I mention it is , I’d like to know more other ways of using it but also want to help anyone else who had the same question on why and when should it be used and the credit card secure example is only one I have so far .

An nice example of Two way iframe communication can be seen here by Petar Bojinov :

I really recommend people have a look at its a nice solution and easy to understand.



React notes For myself – Setting it up

To set up REACT you need to follow these steps:

  1. You need to use install Node Js so you can use the NPM(Node Package Manager)  https://nodejs.org/en/ . Make suire to type node -v . This should print a version number if installed correctly.
  2. You next need to get the React packages from NPM or CDN and create your app
    1. You can get the cdn  links directly https://reactjs.org/docs/cdn-links.html and just import them directly over however I would not recommend this myself but each their own
    2. Or you can go to your command line type in
      npm install -g create-react-app 
      create-react-app my-app 
      cd my-app npm start

       (Much easier 🙂 )

  3. This blog post by : Nipuni Bhagya   https://blog.cloudboost.io/how-to-setup-your-first-react-app-7faf81db8bce is worth checking as it goes through the entire process of creating your set up and first project . She also mentions Babel which is important as this is what will interpret your JSX code . This will save so much time on creating react elements and classes . From the examples below:

Not Using JSX :


by James K Nelson

var rootElement =

React.createElement('div', {},

React.createElement('h1', {}, "Contacts"),

React.createElement('ul', {},

React.createElement('li', {},

React.createElement('h2', {}, "James Nelson"),

React.createElement('a', {href: 'mailto:james@jamesknelson.com'}, 'james@jamesknelson.com') ),

React.createElement('li', {},

React.createElement('h2', {}, "Joe Citizen"),

React.createElement('a', {href: 'mailto:joe@example.com'}, 'joe@example.com') ) ) )

ReactDOM.render(rootElement, document.getElementById('react-app'))

There may be a scenario where you might have to do this but I haven’t come across one myself yet

Using JSX Example :


By Eric Greene

"use strict";

var HelloWorld = React.createClass({

  render: function() {
    return (
      <h1>Hello World!!!</h1>


var mainElement = document.querySelector("main");

ReactDOM.render(<HelloWorld></HelloWorld>, mainElement);


Soon Ill be talking about slowly converting over an MVC project to use REACT.

I think I can sum it up in one quote when talking about REACT in MVC:

“The right man in the wrong place makes all the difference in the world”- GMAN

LampTree Applications : Gobias Coffee

This was the name we choose for our business start up. The company was called LampTree Applications and our initial product was named Gobias Coffee, this was a reference to an old episode of “Arrested Development“,.

The application is a concept for coffee shops to use android tablets for menus, that customers would have access to. The customer would be able to order straight from the tablet and the coffee shop would have the ability to customise the app to display their own logos and special offers/promotions being able to advertise different promotions or change the menus at the click of a button. This was partially inspired from the following video

The unique selling point was the ability to introduce social games that the customers could challenge each other offering discounts or promotions to who ever becomes the champion of a game, Chessmaster, Scrabble King or Lord of Catan for example. The idea being that this would instill a sense of community into the shops customer base as well as giving them reason to spend more time in the shop. The ability to also include subscriptions to digital papers and other publications also allows the coffee shop to offer their customers reading material while they enjoy a lunch or coffee.

The Presentation is available here :

and the document can be viewed here :

I was tasked with gather data on possible clientele and how cost efficiency of how this product could be. I researched into current technologies out there and decided which one would be appropriated over others such as Android over iPad s and research other decisions such as that.This means that I had to find out which products where cheaper and more effective . This was process of basically taken the pros and the cons of each systems this had to be done as certain options wouldn’t not make viable sense if everything is not taken in to account.

The other Members of the group were:

  • Max whose focus was on finding out possible competitors and similar products already in the market.
  • Ray would we thought should be the leader as he had great drive for this product and why really pushed the rest of us into gear
  • and William who did a lot of work on the financial projections for the project.

Time at iTrac Global



ITrac Global was created by global trade compliance & technology experts,using 21th technologies to develop a network centric solution that allows their clients to move goods in an extremely efficient and compliant manner. It is where international trade regulation and compliance is combined with operational know how to build or improve a global trade compliance program that supports the supply chain.
iTRAC Global, Inc.,is  where international trade regulation and compliance is combined with operational know-how to build or improve a global trade compliance program that supports the supply-chain in a compliant and efficient manner.

I met up with Serge who worked for ITrac Global Inc in the lobby when we were being introduced to the Start up companies within the Nexus Building. When I came into ITrac Global I was introduce to all the members of staff by Serge. After I had met up and talked with the other members of staff. I was brought into a meeting to explain how the software worked and then we discussed about creating a potential app that would be similar to their website and transfer over the same functionality from the website. We tried to decide on how it would be designed and how the user/client would use this app. After this meeting I then signed a Nondisclosure Agreement(NDA).

Once this meeting was concluded I decide to divide up my work into separate tasks. I was tasked with creating a User Interface design which is the design of software applications and focusing on the user’s experience and interaction. So initially I began researching into iTrac Global site and how it worked then I began researching into other apps such as Yelp and Hipmunk which were recommended to me by Andrei to try learn from these apps’ functionally and try and take similar concept to bring them towards the app’s design. After doing some research on other apps I began dividing the functionality  again the reason for this was so that I could concentrate on each part separately and be focused on each objective/goal.

So I began working on the Design by firstly drawing up some rough sketches on what the app would possibly look like and how it would function from scene to scene.I created a  high level example for myself so I knew where I was going with the app.I then began working Axure which is program which draws wire frames and has images such as buttons of the Iphone UI(User Interface)which allowed me to create a mock up UI of the app.I concentrated on this part trying to design each section within my timeframe. I showed Andrei the design and we decided on what was more feasible and intuitive.This was a rinse repeat cycle for the project each time refining the process.I try to design it in a way that anyone coming onto this design will be able to modify and add to the project.

What conditions that makes up the successful cluster account of Art?

In a previous lecturer we had a discussion about art and what makes up successful art. Bery Gaut believes that there are ten rules that art must follow that make up the successfully cluster account of art.

  1. Possessing positive aesthetic properties, such as being beautiful, graceful, or elegant (properties which ground a capacity to give sensuous pleasure).
  2. Being expressive of emotion.
  3. Being intellectually challenging(i.e questioning received views and modes of thought ).
  4. Being formally complex and coherent.
  5. Having a capacity to convey complex meanings.
  6. Exhibiting an individual point of view.
  7. Being an exercise of creative imagination (being original ).
  8. Being an artifact or performance which is the product of a high degree of skill.
  9. Belonging to an established artistic form (music, painting, film, etc.)
  10. being the product of an intention to make a work of art. (Gaut, 2000: 28).

These are Bery Gaut’s own opinion on what makes up successful art . I am going to go through each point with my own take either agreeing or disagreeing with Bery.

  1. For the first point I would have to agree with that art needs to have positive aesthetic properties.Why ?Well I believe that art can be quite graphic showing some disturbing scenes as you can see with the painting done below by Francisco de Goya. Successful art can be show the aesthetic values in the expressions of the soldiers about to be shot show grim aesthetic properties.However even though this scene is grim there is greaete aesthetic beauty behind with the expressions of the faces of the men about to die showing great detail which is highlighted as a point of interest.

    El Tres de Mayo, by Francisco de Goya
  2. I would agree with Gaut on this point as art needs to stir a response of emotion from the observers.Art in its self is primal made through emotion however big or small the emotional response.
  3. Again I would have to agree with Gaut , good art always makes us question ourselves on our own thoughts.Breathing new life to an artist’s painting with a new interpretation from all different people.
  4. Art doesn’t need to be complex to be good as art can be anything to anybody one may find the aesthetic shape of a rock noteworthy of art however another may see it  as another rock.
  5. Art does need to the capacity to convey complex meanings arts needs to able to allow all people to understand the art on many different levels from the structure of the painting and aesthetic beauty to the subliminal and underlining details.
  6. No successful art does not need exhibited a individual point of view to as we can look at abstract art and see that most artists within this medium tend to avoid naming their own painting and the meanings behind because they want to engage the opinions of others.
  7. Again I don’t believe that art needs to be original to a work of art as we can look at films which we’re remade taken a different outlook of the same story but with many differences with feel and the look for an example Tim Burton’s Batman 1989 against the recently made Christopher Nolan Batman series or first Casino Royale with Sean Connery compared to the new remake of Casino Royale with Daniel Craig each working off the same material although completely different on out take. Showing that something does not need to be original to be a work of art.
  8. I would agree with this as most of famous art work showed the great skill involved to make it as we can see with Michelangelo‘s Pieta showing the ability he had crafting from marble or the engravinf work of Knight, Death and the Devil by Albrecht Dürer. Showing the the talent within the artist.
  9. Well I completely disagree with this as if that where the case we would only have two art forms music and painting no I believe art creates it’s own artistic form no matter the medium.
  10. No I disagree as the beauty in the world would refute this point with the leaves blooming from trees to the budding of flowers which all have a design purpose to attract insects and the art being a side product of this as it was made for more of functional use.

They are my opinions on these although I agree with some and disagree with others I find that art can be define in many different ways.

War Games

In the previous lecture we discussed war games which discuss the moral and ethically question of the war genre of gaming. War genre gaming can be set in any time period from alternate,futuristic  or any made up scenario it can be seen in different styles of gaming from the RTS(Real Time Strategy ) or FPS(First Person Shooters). In the class we gave our interpretations of war ,this lead to a talk Johan Huizinga who was one of the founders of modern culture. He stated that :

“Summing up the formal characteristics of play we might call it a free activity standing quite consciously outside “ordinary” life as being “not serious ” , but at the same time absorbing the player intensely and utterly”

This lead to a talk about the gap in Huizinga’s Magic Circle(which is a safe place to play) where players in a game play in a comfortable environment where the rules can change within the circle.
Crawford characterizes computer games as representation, interaction, conflict and safety. “a game is an artifice for providing the psychological experience of conflict and danger while excluding their physical realizations, a game is a safe way to experience reality”.

War Games :

Many people these days define that young children should not play war games as it desensitizes them to war that they seeing the opponents in as a war only as AI bots that are programmed to fight. Although I can understand these points that violence of war is left out of most games to create a “enjoyable experience” while gunning down other opponents I can’t credit them alone as of desensitizing people . As for an example a child could turn on any news network and hear the statistics of soldiers who where killed in a fight and nearly most times kids won’t be able to register this and more than likely accept that this is the norm that soldiers in war fight and they die in a way this is more desensitizing than any video game could be. This can be highlighted back to a point made in Potsdam 1945 when the allies leaders met after arguing over opening a new front Stalin responded that ‘when one man dies it is a tragedy, when thousands die it’s statistics”. As it shows the soldiers more of a number than actually person. I like the opposite at times as a game such as Lord of Rings Battle for Middle Earth you can create troops and build like any RTS game however these troops can continue on from mission to mission and I personally found myself trying to protect these troops because in a strange way I was attached to them as they have been around since the first mission and I found put so much time into leveling them up I didn’t want to see them die . Another war game example is Red Alert 2 Yuri’s revenge  , Yuri has powerful mind control abilities that he takes over people to do his bidding and you have to find a way to defeat him and save the world from his tyranny. The thing is tho he has troops that are mind controlled such as his workers who have no weapons and are pretty weak to kill but you feel guilty killing them as they scream for their “Mommy” and start crying at times . I think this important as it’s such a small touch in the game that it leaves you feeling bad for doing such a thing. So personally I think that sometimes the opposite can occur to desensitizing in certain war games.

American Army ?

American army is basically a First Person Shooter created by the American Military the reasoning on why it was created was by Colonel Wardynski who recognized that a video game might be helpful to the U.S. Army in the strategic communication efforts by providing more information to prospective Soldiers and to help reduce the number of recruits who wash out during the nine weeks of basic training. It’s meant to the best top of the line shooter to give a real simulation feel for games.With several thousand players online at any one time between 2002 and 2008, it ranked in the top 10 FPS.

What I think about American Army?

Many people would argue that this game trains kids to become desensitized to battle scenario implying that the enemies are only AI bots that the army are using this to train potential recruits for the future but I funnily enough don’t agree with them for certain reasons

  • And the end of day its still only a simulation,I find it Naive of Colonel Wardysnki thought that this would help stop the number of recruits dropping out after nine weeks training because there is a massive difference between sitting on your couch,picking up a controller and playing the game compare to the actually thing of getting your gear,getting yelled at by your drill instructor,hauling around your heavy equipment  and so. It’s tough and no simulation can every really prepare you for the real thing.
  • Age Restrictions , most of these types of games have age restrictions so that they can’t be played by minors although at times the implementation of this is pretty lax it is there.
  • Choice of different games.

Three essential components of a game: Gameplay, Technology and Story

Technology and gameplay are I think are intertwined together as the gameplay can only be feasibly within  the technology you are using as result this means in a way you can be restricted. As we can see from the early to Atari where they used squares to represent characters and the enemies the technology gave them their boundaries in which they can work. As the Technology expands we can now see the gigantic jump in detail and in gameplay since those days for an example a game such as Deus Ex Human Revolution which can immerse you into the very surrounding of the world and the detail put into it.

Although Story can be important, it’s only as important as the game allows it to be. Stories can suck a player into the game making them feel vital to the game and creating a sense of intrigue into this world and its environments . At times the story can be so powerful within the game it can make the player question his/her’s belief system and what they may think is morally correct or sensible again I believe Deus Ex HR(I really love that game) does this really well and the ending speaks for it self. No one ending is the bad ending,nor is there no good ending only your interpretations on them. I believe story can be vital at times but within context.



Games and Learning

In this week’s lecture we learned about Digital games and learning.We discussed how that the human skills fall into separate branches.

The three skills :

  1. Cognitive Skills which is drive our intellectual judgement.
  2. Psychomotor Skills which is drive our physical judgement
  3. Affective Skills which is drive our social and behavioral judgement

This led onto Bloom’s Taxonomy of Cognitive Learning this is how Bloom categorized learning into 6 levels of growing complexity .
The six categories are Knowledge, Comprehension, Application, Analysis, Synthesis and Evaluation.After this we learned about the different types of Evaluation which are  broken down into

  • Formative  : Aims to refine and improve educational technology while it still in development.
  • Summative: Aims to assess the immediate effectiveness of educational technology once it has been implemented.
  • Integrative: Focuses on the integration of the educational technology.
  • Impact        : Aims to determine if students learning outcomes have changed to the context of use .
  • Educational Technology Audit: An audit of the production implementation, use and the cost-effectiveness of the educational technology on a macro scale.

This led to a large group discussion about the impact evaluational and the different variables involved with it.Near the end of the lecture we began discussing Activity Theory

Activity Theory

This theory emerged from Vygotsky’s psychological research into learning.Which is that the intentional human action is invariably medicated by a tool.

So a thing we came across where people could decide whet ever educational games are fun?

Amy Bruckman[1] argues that for an educational game to be fun they need to drop the drill and repetition method that tend to grating on people. As she state that fun is after thought added the educational core.””Which makes about much sense as chocolate-dipped broccoli”. She states that the models of what it means to be educational games.

However people like Richard e Herring[2] argue that by the educational game nature they should not be fun as the practice of drill and repetition is essentially to understand and replicate.Even if the student interacts with the games it is still not fun as it will be reinforcing core learning principles .

What I thought ?

Well for me I have to agree with Amy in most regards but I believe a game can actually someone’s genuine interest in something to go on their own to figure out more. I do agree with Amy in the sense a lot of educational games tend to put fun in as an after thought reducing an efficiency . But I do believe that certain game can translate fun with education easier than others.

For an example a game about historic period in time such as World War 2 can teach kids a lot the history behind world war 2 and provide interesting details about it such as the Medal of Honor game which the player plays as rank and file soldier through as the American landings at D-Day at Normandy.Already the child unbeknownst to them has already learned information about some of world war 2 and it may spike their interest into researching more it outside. Although I do believe the game may have to take some liberties to make the game enjoyable as well .

From my own experience I played a game called Dynasty Warriors which is the historic period of China during a time of serious unrest during the end the Han Dynasty and the three Kingdoms . This game I played was really fun when I was a kid and really pushed me to go research about it and I think now I have two books about the conflicts . I am no expert in it that field though but I know a lot more about it now that I ever did previously about it.
References :

1.Amy Bruckman [Can Educational Be Fun?] http://www.cc.gatech.edu/~asb/papers/bruckman-gdc99.pdf

2.Richard E. Herring [Educational Computer Games] http://www.cyberroach.com/analog/an19/edu_games.htm