210 likes | 375 Views
Learning WebMatrix Part 3 of 3. Akber Alwani http://twitter.com/epdotnet. Agenda. Part 1 What is WebMatrix? Razor Syntax Database Access WebGrid Part 2 Layouts Helpers Themes, Package Manager, Facebook and more Membership Routing Part 3 Building Helpers WebMatrix and OSS Web Apps
E N D
Learning WebMatrixPart 3 of 3 AkberAlwani http://twitter.com/epdotnet
Agenda • Part 1 • What is WebMatrix? • Razor Syntax • Database Access • WebGrid • Part 2 • Layouts • Helpers • Themes, Package Manager, Facebook and more • Membership • Routing • Part 3 • Building Helpers • WebMatrix and OSS Web Apps • Publishing your website or web app • How to “grow up” to Visual Studio 2010 and ASP.NET MVC
Why Build Helpers? • 1. Helpers make you more productive • Create Helpers for code that is repetitive • Create Helpers for code that is complex • 2. Helpers make it easier for other developers to use your widgets or services • Useful if you are trying to create a developer ecosystem of your own
Building Helpers – inline syntax • Use CSHTML • Save in App_Code folder • The name of the file is important – it’s used as the class name: @FacebookSocialPlugins.ShowLoginButton(...);
Building Helpers – inline syntax • @helper • Easy to create HTML shortcuts • Wrap commonly used HTML • Takes parameters • Real example: Facebook Social Plugins @helper HelloWorld(string name = "") { <div>Hello @name</div> } @helper ShowLoginButton(string buttonText = "") { <fb:login-button>@buttonText</fb:login-button> }
Building Helpers – inline syntax • @function • Return values from your helpers • Good for wrapping complex APIs • See the Twitter Helper for examples @functions { public static string SayHello(string name) { return “Hello ” + name; } }
Demonstration Building Helpers
Why use Open Source Apps? • Free & Popular • Large developer ecosystems with lots of widgets, plugins, templates and themes • Good community support through blogs and forums • Gets you closer to a solution • CMS, eCommerce, Forum etc. • Easy to configure
WebMatrix and OSS Apps • WebMatrix builds on the success of the Web Platform Installer 2.5 Million Apps downloaded so far
Demonstration Install a WEB app
Publishing your website • It’s easy to find a host that fits your needs and budget • Publishing your website is easy and pain free • Faster and more secure • If you make changes, you only upload the changes – not the entire website
Windows Web Hosting Gallery • Find the right host for you • Quickly compare the best deals • www.microsoft.com/web/hosting
Publishing in WebMatrix • Easy to configure, preview and publish your website and database in one click
Demonstration Publishing your website
Growing Your App With a little luck, your web application will be successful and attract lots of users! • Congratulations • You need to ask yourself some questions: • Do I need more developers? • Is my code base still manageable? • Do I need to scale my web & database servers? With a successful application the answer will normally be “YES” to those questions
Growing Your App • Visual Studio 2010 provides the best solution to your “growing” needs: • Powerful editing capabilities • Testing Frameworks • Source/Version Control • Moving to Visual Studio 2010 is easy • The Razor Syntax is common across WebMatrix and ASP.NET MVC 3 • You can use Helpers in ASP.NET MVC 3 • Migration of database to IIS Express is easy to do
Demonstration Growing your app
Recap • Part 1 • What is WebMatrix? • Razor Syntax • Database Access • WebGrid • Part 2 • Layouts • Helpers • Themes, Package Manager, Facebook and more • Membership • Routing • Part 3 • Building Helpers • WebMatrix and OSS Web Apps • Publishing your website or web app • How to “grow up” to Visual Studio 2010 and ASP.NET MVC • Roadmap
Get this content, and more • www.webcamps.ms • www.asp.net/webmatrix • www.microsoft.com/web/webmatrix
You are a Web Camper! • Join in the community! • Facebook Fan Page (search for Web Camps) • Follow @Webcamps on Twitter