The article provides a quick guide to understanding Entity Framework.

Why Entity Framework?

Entity Framework is an ORM layer which implements the Unit of Work pattern. The library keeps a track of all changes made to database entities. It saves all changes in a single transaction.

DbContext class keeps track of the entities. The SaveChanges method saves multiple updates in a single transaction.…

Read More

Entity Framework is an ORM framework for .NET applications. We specify the mapping between .NET classes and corresponding database tables. Tables are related to one another. The common relations are One-to-One, One-to-Many or Many-to-Many.

  • One-to-One: Record in TableA maps to a record in TableB.
  • One-to-Many: Record in TableA maps to multiple records in TableB.
  • Many-to-Many: Record in TableA maps to multiple records in TableB and one record in TableB maps to multiple records in TableA.
Read More

Elastic is a search engine built on top of Lucene. We build Auto-complete capability with Elastic.

Setting up Elastic

Download the zip file from Elastic site. Extract the zip file to a suitable folder. From the bin folder, run service.bat install. In the service manager, adjust the settings for the service. If you encounter Java errors, install Java runtime (8) from Oracle website.…

Read More

Cross cutting concerns (wiki) are common architectural elements such as logging, instrumentation, caching and transactions. In this article, we will explain how we integrate these into our projects. The functional classes in our project may use logging or caching within their method. Or they may not know that these other classes exist. We will cover both scenarios.

Decorator pattern

Decorator pattern is an elegant solution to implement cross-cutting concerns.…

Read More

FAST is a search engine used for enterprise search. In FAST, a View specifies how content is structured. It has collections. A collection has documents. Each document has a specific structure, specified by fields.

Apart from specifying the content, a View has certain parameters to fine-tune the search. For example, parameters like lemmatisation and spell-check control the results returned by a search.…

Read More

HttpClient

The typical way to access a REST API is using the HttpClient. Create a HttpClient object. Pass in request headers. Call the PostAsync method with the URL and the request body. Use await keyword to wait for the response. Get the message as a JSON string. Use JavaScriptSerializer to convert the JSON to a C# object.

async Task<int> GetResultUsingHttpClient()
{
    Uri uri = new Uri("http://localhost/api/Algebra
                      /DoAlgebra?num1=3&num2=4");
Read More

Isolated Storage in Windows Phone stores data specific to an app. The storage space is not shared with other apps. SQLite is a light-weight database. And for mobile apps, it is common to store app specific data in SQLite. Windows Phone apps store SQLite database in Isolated Storage.

The usual way to open a connection to the SQLite database is using the path to the database file.…

Read More