Extension method extends an existing class. In this post, we will add an extension method to HtmlHelper class. The method display error messages.

Validation

Data annotations validates user input. An example is shown below.

[Required(ErrorMessage = "Please enter name")]
public string Name { get; set; }

Controller has the ModelState object. ModelState object has the validation errors. For each user input (eg.…

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

NServiceBus is similar to BizTalk. BizTalk is a message broker. NServiceBus is a message bus. It implements the bus architecture where backend systems have the infrastructure to process messages. Internally, NServiceBus uses MSMQ for receiving messages and RavenDB for scalability and transactions.

There are two types of message processing: Commands and Events. Command messages are sent to endpoints. Applications listening at the endpoint process the messages. …

Read More

SQLite is an open-source SQL database engine. It is widely used in iOS apps. The database is available in the form of a file.

Create Database

To create a database with name accounting:

sqlite3 accounting.sqlite

.tables is a command which lists all tables. Add a new table, Company. And insert a few rows.

CREATE TABLE company 
(id int, seats int);
INSERT INTO company (id, seats)
VALUES (1, 20);
INSERT INTO company (id, seats)
VALUES (2, 30);
INSERT INTO company (id, seats)
VALUES (3, 50);

ALTER TABLE has restricted syntax.…

Read More