Skip to main content

CODING

Bash Website Backup Script

We wrote tutorial how to crate cron jobs in CPanel and now we're continuing with instructions for creating a simple bash website backup script that works on Linux hosting environment.

Entity Framework Tips and Tricks

Inforbiro is an Information Technology and Marketing Agency with its own Internet marketing network BlicKlik. We have a lot of experience in software development as well as in Internet marketing and advertising.

We constantly try not only to develop great web sites, mobile, desktop or facebook applications but also to share our knowledge.

Therefore, below is a collection of Entity Framework Tips and Tricks articles written on our company blog that could be useful to all of you.

Entity Framework - First(), Single(), FirstOrDefault(), SingleOrDefault() Differences

Differences between First() and FirstOrDefault() and Single() and SingleOrDefault()

Single() returns a single item and throws an exception if there is either none or more than one item. First() returns the first item or throw when there is no item. FirstOrDefault() returns the first item or return null (in most cases) when there is no item.

SQL Server - Enable / Disable Identity Insert

Default behavior in the SQL Server for adding new row with identity column set to autoincrement is that you are not able to insert new row with specified id column. 

For example, you're not allowed to execute query:

INSERT INTO Students(Id, Name) VALUES(1, 'John')

but only

INSERT INTO Students(Name) VALUES('John')

Id value will be autogenerated for you instead.

The only way to avoid this behaviour is to to set IDENTITY_INSERT for the table that you want to insert new row into.

Entity Framework - Collection Modified Issue

If you try to change collection (add or remove element) while you looping through it, the following error message could appear:

InvalidOperatioException was unhandled