Tag Archives: database

Rename Table and Column Name in EF Code First

Business rules change over the time. For developers, this can be frustrating. Especially after you have spent enormous amount of time to name your objects properly. After all, we all know naming is the most prominent process of the development.. ūüôā

Luckily, in Entity Framework, you can change table names quite easily.

Two ways, using data annotation and Fluent API. (Code is in Entity Framework 6)

Data Annotations

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Change table name to People
public class Employee
    // Change column name to PersonId
    public int Id { get; set; }
    public Guid DepartmentId { get; set; }
    public int CompanyId { get; set; }
    public string Firstname { get; set; }
    public string Lastname { get; set; }


Context file (inherit from DbContext)

using System.Data.Entity;

protected override void OnModelCreating(DbModelBuilder modelBuilder)
    // Change column name to PersonId
        .Property(p => p.Id)

    // Change table name to People
Leave a comment

Posted by on June 18, 2015 in General


Tags: , ,

Add Authentication to MongoDB Database

To prevent un-authorized access to your MongoDB database, you can add security to it by requiring authentication whenever someone tries to connect.

It’s simple, run the mongod with --auth option. the command is:

// To add user
> use admin;
> db.addUser('admin','123456');

// Start mongod with --auth
$ sudo mongod --auth --dbpath /data

// Run mongo and login
$ mongo localhost:27017
> use admin
> db.auth('admin','123456');

// Include login in mongo command
$ mongo localhost:456789/admin -u admin-p 123456

More MongoDB security option:

1 Comment

Posted by on May 7, 2015 in General


Tags: , , ,

What is Sharding?

Sharding is a type of database partitioning that is used to separate very large databases the into smaller, faster, more easily managed pieces called data shards.

It’s partitioning that separates very large databases the into smaller, faster, more easily managed parts called data shards. The word shard means a small part of a whole.

Leave a comment

Posted by on January 8, 2015 in General


Tags: , , , ,

SQL Server Instances You May Not Know You Have

There are 3 SQL Server database instance in most¬†local machines. These are SQL Server Express instances that mainly useful for developers so they don’t have to install any SQL Server instance to get a project up and running. They are:

    For example: “stack247\SQLEXPRESS”, or simply “.\SQLEXPRESS”.
    This is older version of SQL Server Express, 2008 to be precise. It’s also installed when you install Visual Studio 2010.
  • (LocalDB)\v11.0 or¬†(LocalDB)\v11.1
    Comes with SQL Server 2012 or Visual Studio 2012. This is a newer version of SQL Server Express, or as the folks at SQL Express team call it, an improved SQL Express. The official name is SQL Express LocalDB
  • (LocalDB)\Projects
    Mainly used as default database by SQL Data Tools to host sandbox databases for your Database projects. Just like SQL Express LocalDB, it also comes with SQL Server 2012 or Visual Studio 2012.
  • (localdb)\mssqllocaldb
    SQL Server 2014 uses this as local database. This is also a default database where Azure Storage Emulator first initialize its database.
Leave a comment

Posted by on December 18, 2014 in General


Tags: ,

MongoDB Terminology Translation from RDBMS

Database Database
Table Collection
Row Document
Index Index
Join Embedding & Linking

Source: 10gen’s Schema Design

Version attow: MongoDB 2.6

Leave a comment

Posted by on August 11, 2014 in General


Tags: , ,


The process of attempting to optimize the read performance of a database by adding redundant data or by grouping data.

For online analytical processing¬†(OLAP – primarily read operation)¬†databases, redundant or “denormalized” data may facilitate¬†business intelligence¬†applications.¬†In many cases, the need for denormalization has waned as computers and RDBMS software have become more powerful, but since data volumes have generally increased along with hardware and software performance, OLAP databases often still use denormalized schemas.

Source: Wikipedia: Denormalization

Leave a comment

Posted by on July 29, 2013 in General


Tags: ,

%d bloggers like this: