Friday, June 13, 2014

How to: Create ASP.NET MVC Authentication tables in an existing database

Hi All,

I am writing this blog post to show how to migrate or move the standard MVC authentication tables into your existing database in your web application.

When you create a MVC web application in VS 2013, VS embed a sql server database in your project, and this project is being used as a source of membership. Since you will not use this database as an embedded file and you want to have it as part of your existing database in SQL Server instance. The file is created under App_Data folder. To see the .mdf file click on Show all files in the solution explorer.
You can see the contents of this database and all tables in the server explorer window.

How to create those tables in SQL server ?

First, you can delete the .mdf file in App_Data folder. Since we don't need any of these tables.Then, we need to update the default connection string in the web.config to point to our database.

    <add name="DefaultConnection" connectionString="Data Source=SERVER\INSTANCENAME;Initial Catalog=DBNAME;Integrated Security=True" providerName="System.Data.SqlClient" />

Third, Open Nuget Package Manager and write the following commands:

Add-Migration Init

Check out your database, all ASP.NET membership tables with Prefix Asp have been create and then you can test it out by running your application and execute membership actions such as Signing up or Signing in to your application.

Created tables after running above commands:

Hope this helps.


-- ME

Tuesday, June 10, 2014

Getting started with Solr for .NET architects & developers - part 1

Hi folks,

I am writing this blog post to provide some tips and insights on using open source search technologies such as Solr in your solutions and applications.

Here are my notes:
1) Solr is an open source search server product. It is free and one of the most trusted, mature search products in the market.

2) Solr uses lucene, lucene is the heart of Solr search server product. Lucene is the full text service or component that is used in Solr which provides all search, index and queries capabilities.

3) Lucene is a java based library to create, manage, and retrieve inverted index files.

4) Inverted index is a specialized data structure by Lucene to handle queries to text based documents.

5) Using full text feature that is available in some DBMS is not a replacement for Solr, Solr provides advanced search, query and ranking capabilities.

6) Solr provides on top of lucene full text capability the following features: pagination, sorting, faceting, auto-suggest, spell checker, hit highlighting, data modeling, grouping, and standard http API to integrate with your solutions.

7) Each Solt server has only one home, the path of the home is $SolrInstallation/example/solr, where $SolrInstallation is the path where you installed solr binaries.

8) Each Solr server can contain more than 1 core, each core contains its index data and configuration.

9) Solr web application is stored under solr.web folder which contains all servelts, html and js files.

10) Solr is running on Jetty as an application server. Google is using Jetty in its App Engine platform.

Hope this helps.

References: Solr in Action