Posts

How to connect to database using Server Explorer in Visual Studio

Image
Steps to connect to your database using Server Explorer in Visual Studio Open Visual Studio, Select View → Server Explorer Right Click on Data Connections and select Add Connection... If you are not connected to a database from Server Explorer then you will need to select Microsoft Server as the data source. You can connect to either localDb ((localdb)\v11.0) or SQL Express ( ./SQLEXPRESS ), In my case I am connecting to SQLEXPRESS which is hosted my machine(MYNA) so the name will be “ MYNA\SQLEXPRESS ”  and then select your existing database or you can define new database which will get created. Once you are done , You can check the database in the Server Explorer 

Entity Framework : How to create database using code

Image
This is a step-by-step walkthrough which will create a new database using C# code. We will create one console Application which will create an empty database and will also add new tables too. Pre-Requisities We need to have Visual Studio 2013 installed to complete this walkthrough.(You can use older version too like 2010 or 2012 to complete this tutorial.) Apart from that, You will also need to have NuGet installed on your Visual Studio. Steps : 1. Create new Application Open Visual Studio, Click File -> New -> Project Click Console Application under templates -> Visual C# -> Windows Enter Name as CreateNewDatabase and Select OK 2. Create the Model Now we will create two simple model(Employee, Manager) using classes. As a part of demo I'll define both in Program.cs but in a real word application we should define in two separate file/classes. Add the following two classes in Program.cs. public class Manager ...

What is NuGet and how to install it on Visual Studio 2013

NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers. How to install NuGet using Visual Studio Extension Manager : Open Visual Studio, Click Tools and then Extension Manager . Navigate to Online , Find NuGet Manager Extension and click Download In the Installer dialog box, click Install . When installation is complete, close and re-open Visual Studio. NuGet is now ready to use.

What is Entity Framework ?

Image
Entity framework is an Object/Relational Mapping (O/RM) framework. It is an enhancement to ADO.NET that gives developers an automated mechanism for accessing & storing the data in the database and working with the results in addition to DataReader and DataSet. It eliminates the need for most of the data-access code that developers usually need to write. It allows you to create a model by writing code or using boxes and lines in the EF Designer. Both of these approaches can be used to target an existing database or create a new database. It also provides services like change tracking, identity resolution, lazy loading, and query translation so that developers can focus on their application-specific business logic rather than the data access fundamentals. Following figure shows the overall architecture of the Entity Framework (Source : http://www.codeproject.com/ ) Application : Application which is going to use Entity Framework. EDM (Entity Data Model): EDM consist thr...

How to set permanent IP in Ubuntu ?

Image
Steps : *) Open the interfaces file :           sudo vi /etc/network/interfaces If you are using DHCP you will see the following lines :           auth eth0           iface eth0 inet dhcp  *) To make it static, Change the line iface eth0 inet dhcp to iface eth0 inet static and add the following just below it: address 10.35.34.209 (IP address that you need to set) netmask 255.255.255.0 (Default mask which in this case is the default class c subnet) gateway 10.35.34.1 (Typically your router’s IP address) network 10.35.34.0 (The network that this machine is running on) broadcast 10.35.34.255 Here is a screenshot of how it should look below : *) Once you save this file you need to restart your networking service.        sudo /etc/init.d/networking restart or         sudo service networking restart Note :   /etc/init.d/networking restart command i...

How to connect via SSH (putty) to your vmware machine (Ubuntu) ?

Image
It was really a pain for me to work on Oracle VM, It won't allow you to use mouse or do copy-paste. So I decided to connect my local VM via SSH( Putty). Steps : 1.  In your VM box, Goto Settings -> Network ->Adapter 1 and select "Bridged Adapter" 2. In your Ubuntu Machine, Install "openssh-server"            sudo apt-get install openssh-server 3. Reboot the VM and Run "ifconfig" command in terminal and get "inet addr" of "eth0". 4. Open putty, Enter the IP address(IP of your VM machine ) , Select port as "22" and connection type as "SSH" and click on open button. 5. Enter your credential and you are done :)

Working of WSO2 Identity Server

Image
To enable OAuth support for your client application, First we need to register our application on WSO2 Identity Server. Step to register Client App on WSO2 IS : Goto Management Console and Enter your username and password. By default its “admin”. Click Main button and then OAuth in Manage menu. Click on the Register New Application link on the OAuth Management page. Select OAuth 2.0 as the OAuth Version . Enter Application Name and your Callback Url . For this app to work use http://localhost:8080/playground/oauth2client .       5. Click on Add button , you will see your application under the OAuth                Management Page. Click on the WSO2 application and copy the Client ID, Client Secret, Access Token URL and Authorize URL. We need these values for our web app. You are done with the registration part..!!! Sample App wi...