Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst

Post on 22-May-2015

1.370 views 0 download

Tags:

Transcript of Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst

Building CLR/H Registration Site

with

ASP.NET MVC4 and EF4.1 Code First

Requirements of registration site.

• Attendees can do registration from Web.

– Entry name, e-mail, twitter id ...

• Share attendees list only within CLR/H staffs.

– The list is used by staff at reception.

Today’s key words

ASP.NET MVC4 Visual Studio

11 Beta

Entity Framework 4.1

Code First

Twitter Bootstrap

AppHarbor

ASP.NET

Web API

Git

Web Pages View

“Razor” Syntax

SQL

Server

2012

LocalDB

NuGet

Create It!

Live Demo

Publish to internet It!

Next step...

Why AppHarbor?

• The most reason is... I interested in it! :)

• Second reason, it is low cost at start up.

– Form $0 for ASP.NET Web Site hosting.

– From $0 fot Rent SQL Server (20MB limited).

Notice

• You must store the all NuGet packages which

installed into Git repository.

– I tried “NuGet Package Restore” feature, but it didn’t work.

• EF4CodeFirst “DropDatabase” initializer

doesn’t work.

– Because the database is not mine.

It is only rental.

So, we can not drop it.

– You must use “CreateTablesOnly” initializer.

(install from NuGet.)

Publish to internet It!

Live Demo

Authenticate & Authorize It!

Next step...

How to

authentication?

Windows

authentication?

No.

It is internet site,

not intranet.

Forms

authentication?

Sorry.

I do not choose

Forms

authentication

today.

My choice is...

HTTP

Basic

Authentication!

Why HTTP Basic Authentication?

• Becase, it is HTTP standard.

• So that, we can authenticate any clients by

standard way.

• For example...

Microsoft Excel

“Web Query” feature!

How to add in Basic auth function

in your Web app?

• Not use IIS function.

– It depend on Windows local user account, or

Active Directoy.

• Instead, install “HTTP Auth Module” from

NuGet.

Authenticate & Authorize It!

Live Demo

Provide web api!

Next step...

Provide web api!

Live Demo

Extra Stage!

Next step...

I think, it is not Best solution...

• There is no function to manage user

account s, yet...

– We can configure HTTP Auth Module to use

MembershipProvider, but...

• Excel Web Query is Very convenient, but it

is not full automatic.

– We have to sync manualy.

I have an idea :)

Google

Spread Sheet :P

Using Google Spread as a Database

• Install “GDataDB” from NuGet!

• Then, you can use Google Spread Sheet as

a Database.

– Spread Sheet Documents = Databases

– Work Sheets = Tables

– Rows = Entities

– Columns = Properties of Entity

– Column name mapped to property name.

Store into Google It!

Live Demo

Advantage

• Easy to share and access control.

– Based on Google Documet platform.

• Nothing to do.

– “Sync” is not required.

• But... It is very slow :(

– It is not “real” database.

Conclusion.

At last...

• VS11 is very powerfull, and EF41CodeFirst

allows you to develop rapidly!

• You can get anything you want from NuGet!

– Many many usefull libraries, modulues...

– Many many nice girl friends...

• Excel Web Query is nice feature!

– Keep the way to HTTP standard.

• You can publish your Web apps without cost by

AppHarbor!

– With SQL Server, not only Web app hosting!

Thank you!