|
Posted
over 12 years
ago
by
ChristophWille
Welcome to a series of really short posts about features in SharpDevelop that you might not know.
Did you know that you can reorder entire lines of source code by pressing Alt+Up to move a line above the previous line of code, and Alt+Down to move
... [More]
it below the next line of code [*]? Simply place the cursor in the line that you want to move, and press the respective key combination!
[*] Empty lines are skipped, and best of all, comment lines preceding the line you are moving are copied too! [Less]
|
|
Posted
over 12 years
ago
by
Rpinski
SharpDevelop allows to extend its features by installing AddIns. With SharpDevelop 5 we bring a new and modern AddIn Manager interface into the IDE:
It can be found at the same place as the former one (Menu Tools / AddIn Manager) and supports
... [More]
installing, updating, disabling or removing SharpDevelop AddIns.
Installation from online repository
Completely new is the possibility to connect to an online NuGet-based repository to install or update your AddIns from. A central repository maintained by the SharpDevelop Team will be predefined. Custom repositories can be added through preferences. You can browse all repositories through the navigation bar on the left:
Selecting one repository shows installable NuGet packages containing SharpDevelop AddIns:
After clicking the Install button the NuGet package is downloaded and marked for installation:
A restart of SharpDevelop is needed to complete the installation. After that the AddIn will be shown in the "Installed" list:
Installation from package file
As in SharpDevelop 4 we still support installing an AddIn from an *.sdaddin package file:
After selecting the archive the procedure is the same as with NuGet-packaged AddIns: It will be marked for installation ...
... and after restarting SharpDevelop it will appear among other AddIns:
[Less]
|
|
Posted
over 12 years
ago
by
ChristophWille
Note At the time of writing / recording, you need the source code version of SharpDevelop from the NuGet 2.5 branch. The bits will be merged into the upcoming SharpDevelop 4.3.2 (to be properly announced by Matt soon).
I have put together a short
... [More]
video that shows how to get started with Azure Mobile Services in SharpDevelop:
http://youtu.be/RhxaFWcihGw
For your reference, here is the source code of this simple CR application:
Code:
using System;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json;
namespace sddemoazure
{
public class TodoItem
{
public int Id { get; set; }
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
[JsonProperty(PropertyName = "complete")]
public bool Complete { get; set; }
}
class Program
{
public static void Main(string[] args)
{
TalkToZumo().Wait();
Console.ReadKey();
}
static async Task TalkToZumo()
{
var zumoClient = new MobileServiceClient("appurihere", "applicationkeyherer");
IMobileServiceTable<TodoItem> todoTable = zumoClient.GetTable<TodoItem>();
var todoItem = new TodoItem()
{
Text = "Get stuff done with Azure Mobile Services!"
};
await todoTable.InsertAsync(todoItem);
Console.WriteLine("Inserted item, index " + todoItem.Id);
var items = await todoTable
.Where(ti => ti.Complete == false)
.ToListAsync();
Console.WriteLine("Got " + items.Count + " items from Azure");
}
}
}
[Less]
|
|
Posted
over 12 years
ago
by
MattWard
SharpDevelop 4.3.1 now has support for TypeScript with an early beta release of a new Addin.
The Addin glues together the TypeScript language services, which provide all the features needed for code completion and refactoring, and SharpDevelop
... [More]
using Javascript.NET as the bridge between them. Javascript.NET allows SharpDevelop to host Google's V8 JavaScript engine and have JavaScript code interact with .NET objects.
Features
TypeScript compilation on save or build.
Code folding.
Code completion
Find references
Rename refactoring
Go to definition
Quick class browser support.
TypeScript syntax highlighting
The addin supports:
SharpDevelop 4.3.1
TypeScript 0.8.3.1
Let us take a quick look at some of these features.
Code Completion
Code completion works when you press the dot character.
Code completion also works when you type the first bracket of a function.
Find References, Go to Definition and Rename
These menu options can be found by right clicking on a class or a class member.
Go To TypeScript Definition will show the corresponding type definition. Find TypeScript References will show the reference locations in the Output window. Rename will open a dialog box where you can type in the new name and click OK to have it updated everywhere it is referenced.
Getting the Addin
The addin's source code is available on GitHub. A zip file is available to download containing the pre-compiled addin. Simply unzip the files and install into SharpDevelop using the Addin Manager. The Addin Manager is available by selecting Addin Manager from the Tools menu. Install the addin by clicking the Install Addin button and then restart SharpDevelop.
Configuring TypeScript Compiler Options
The compiler options are available from the Options dialog (Tools - Options) under the Text Editor category. Here you can change when the compiler is run and what options are passed to the compiler when generating JavaScript code.
Limitations and Known Issues
Limitation with multiple projects using TypeScript files in the same solution. All files are included in the same scope.
Performance problems - currently doing work on the UI thread and also re-parsing all TypeScript files each time when a code completion action is triggered.
Different behaviour to Visual Studio with classes show in the code completion window. Visual Studio only shows code completion for TypeScript files you have explicitly referenced in a comment. SharpDevelop shows everything in the current project.
Unable to easily replace the existing SharpDevelop menu options such as Find References so the standard shortcuts will not work.
No support for hovering over a type with the mouse and seeing a tooltip with information about the type.
[Less]
|
|
Posted
over 12 years
ago
by
siegi44
The Markdown syntax for formatting text recently gained more and more visibility and is used especially on StackExchange, GitHub and so on. Hence we added simple highlighting support for Markdown.
Here's an example of what it currently looks like in
... [More]
SharpDevelop:
As you can see, it is far from complete, but it is a good start.
If you have a weekend to spare and want to help out, you could help us with one of the following features:
Code completion
Folding
Extended highlighting
Live preview view content
(We won't do those any time soon, because there are more important things to be done in SharpDevelop 5) [Less]
|
|
Posted
almost 13 years
ago
by
ChristophWille
SharpDevelop 5 has been long in the making, with the bulk of the time being spent on the move to NRefactory 5
(more information).
Today we finally have something to show - a C#-only tech preview of SharpDevelop 5. It is not polished, but it will
... [More]
give you an idea
what cool things are now possible - code actions being the poster child of the new features coming.
Download
Build 2100 Setup
Build 2100 Source Code
Newer versions can be downloaded from the build server, expect more activity once
SharpDevelop 4.3 has shipped.
Features entirely not available
Languages other than C# (VB.NET, IronPython, IronRuby)
Windows Forms designer
XAML code completion
Profiler
Reporting (SharpDevelop Reports)
Features with restricted functionality
NuGet: PowerShell is not yet available (console and PS scripts on install of a package).
WiX: dialog designer is not yet available.
ASP.NET MVC: Code completion and folding currently disabled for Razor and Web Forms (.aspx) files.
Debugger: The object graph visualizer doesn't support collections yet; performance issues for larger collections.
[Less]
|
|
Posted
almost 13 years
ago
by
MattWard
It has been a while since NuGet support was added to SharpDevelop so, after David Fowler announced that he had got NuGet building under Mono, I had a look at porting the SharpDevelop addin over to MonoDevelop and created a NuGet addin for
... [More]
MonoDevelop.
The addin provides a Manage Packages dialog that you can use to add, remove and update NuGet packages in a similar way to Visual Studio or SharpDevelop. Here is a screenshot of the Manage Packages dialog open in MonoDevelop running on OpenSuse 12.2
The addin has been tested with the following:
MonoDevelop 3.0.5
Mono 2.10.9
OpenSuse 12.2
Windows 7
The addin uses a slightly customised version of NuGet.Core based on the original NuGet's source code available from the mono-build branch. The source code for this customised NuGet.Core is available on GitHub.
Getting the Addin
The addin's source code is available on GitHub.
The addin is also provided as a pre-compiled binary available to download from a custom MonoDevelop repository:
http://mrward.github.com/monodevelop-nuget-addin-repository/3.0.5/main.mrep
You can add this repository to MonoDevelop via the Add-in Manager.
Please note that the addin is a beta release and more work is still to be done.
Manage Packages Dialog
The Manage Packages Dialog can be opened from the Projects menu by selecting Manage NuGet Packages.
It can also be opened by selecting the Solution window, right clicking either the solution, the project or the project's references and selecting Manage NuGet Packages.
As a NuGet package is installed or uninstalled you can see the package operations that executed by expanding the Messages section near the bottom of the dialog.
Configuring Package Sources
NuGet Package Sources can be configured in MonoDevelop's options.
In Linux you can open the options dialog by selecting Preferences from the Edit menu. In Windows you can select Options from the Tools menu. In the Options dialog scroll down the categories on the left hand side until you find NuGet and then select Package Sources. Here you can add and remove NuGet package sources.
PowerShell
Any PowerShell scripts in a NuGet package will be ignored by the addin since Mono does not currently have support for them.
There have been some attempts to implement PowerShell on Mono starting with Igor Moochnick who created Pash in 2008. Work on this was picked up launchpad.net by Jonathan Ben-Joseph but that work stopped. The latest effort on bringing PowerShell to Mono is Jay Bazuzi with recent work done on the Pash source code available on GitHub.
Pash on SourceForge
Pash on LaunchPad
Pash2 on GitHub
There was also some discussion in the NuGet forums on allowing some way of being able to write a .NET version of the PowerShell scripts (install.ps1, uninstall.ps1 and init.ps1). [Less]
|
|
Posted
almost 13 years
ago
by
cssdadmin
One of the goals for SharpDevelop 5 is to convert legacy XML Forms (xfrms) to WPF, and drop support for XML Forms entirely. Now, you might be asking "Did I miss a Microsoft UI technology?" No, you didn't. XML Forms is a SharpDevelop-internal
... [More]
mechanism for declarative form design (for Windows Forms) that predates WPF by a couple of years - and it shows its age especially when it comes to more design-centric issues (I already mentioned: it is Windows Forms).
To have some of the benefits today, I started the conversion on SharpDevelop 4.3 (it will also be easier to merge between the branches this way). In order for you to know where those conversions happened - and why some behavior might have changed (bugs: please let us know!) - this blog post shows a full list of the changed addin and panels.
Fully Converted Addins
Any and all forms in those addins have been converted:
CppBinding
CSharpBinding
VBNetBinding
ICSharpCode.CodeAnalysis (FxCop)
ICSharpCode.SourceAnalysis - (MattEverson.SourceAnalysis) (StyleCop)
ICSharpCode.CodeCoverage
Converted Option Panels (Options Dialog)
The panels have been converted, and they now derive from ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectOptionPanel (important for those of you interested in building new addins):
CSharpBinding.OptionPanels.BuildOptions
ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents
ICSharpCode.SharpDevelop.Gui.OptionPanels.Signing
ICSharpCode.SharpDevelop.Gui.OptionPanels.ReferencePaths
ICSharpCode.SharpDevelop.Gui.OptionPanels.ApplicationSettings
ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions
ICSharpCode.CppBinding.Project.ApplicationOptions
ICSharpCode.CppBinding.Project.PreprocessorOptions
ICSharpCode.CppBinding.Project.LinkerOptions
ICSharpCode.VBNetBinding.OptionPanels.ProjectImports
ICSharpCode.VBNetBinding.OptionPanels.BuildOptions
ICSharpCode.AspNet.Mvc.WebProjectOptionsPanel
ICSharpCode.SourceAnalysis.AnalysisProjectOptionsPanel
ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanel
ICSharpCode.CodeCoverage.CodeCoverageProjectOptionsPanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference.ServiceReferenceOptionsPanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectCustomToolOptionsPanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.TaskListXaml
ICSharpCode.SharpDevelop.Gui.OptionPanels.SelectStylePanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.SelectCulturePanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectAndSolutionOptions
ICSharpCode.SharpDevelop.Gui.OptionPanels.LoadSaveOptions
ICSharpCode.SharpDevelop.Gui.OptionPanels.EditStandardHeaderPanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.CodeGenerationPanel
ICSharpCode.SharpDevelop.Gui.OptionPanels.ExternalToolPanel
ICSharpCode.SharpDevelop.Editor.CodeCompletion.CodeCompletionPanel
ICSharpCode.Profiler.AddIn.OptionPanels.General
CSharpCode.PythonBinding.PythonOptionsPanel
ICSharpCode.XamlBinding.Options.CodeCompletion
Debugger.AddIn.Options.DebuggingOptionsPanel
ICSharpCode.PackageManagement.RegisteredProjectTemplatePackageSourcesView
ICSharpCode.PackageManagement.PackageManagementOptionsView
MSHelpSystem.Help3OptionsPanel
ICSharpCode.UsageDataCollector.OptionPage
ICSharpCode.FormsDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel
ICSharpCode.FormsDesigner.Gui.OptionPanels.GridOptionsPanel
ICSharpCode.FormsDesigner.Gui.OptionPanels.GeneralOptionsPanel
ICSharpCode.XmlEditor.XmlEditorOptionsPanel
ICSharpCode.AvalonEdit.AddIn.Options.TextViewOptions
ICSharpCode.AvalonEdit.AddIn.Options.HighlightingOptions
ICSharpCode.AvalonEdit.AddIn.Options.GeneralEditorOptions
ICSharpCode.AvalonEdit.AddIn.Options.BehaviorOptions
HexEditor.View.HexEditOptionsPanel
ICSharpCode.CodeAnalysis.AnalysisIdeOptionsPanel
ICSharpCode.CodeCoverage.CodeCoverageOptionsPanel
ICSharpCode.SourceAnalysis.AnalysisIdeOptionsPanel
The work for 4.3 in this area is now done, the conversion will be completed in SharpDevelop 5. [Less]
|
|
Posted
about 13 years
ago
by
MattWard
SharpDevelop 4.3 now has support for Code First Migrations using Entity Framework 5.0.
Microsoft added Code First Migrations to Entity Framework in version 4.3 in February 2012. Code first migrations allows database changes to be implemented with
... [More]
code. The official Entity Framework NuGet package includes three PowerShell cmdlets that extend the NuGet Package Manager Console allowing you to quickly create and use these code first migrations:
Enable-Migrations: Adds support for migrations to your project.
Add-Migration: Generates code for a database migration based on changes to your database model.
Update-Database: Applies migrations to the database.
The PowerShell cmdlets in the official EntityFramework NuGet packages are Visual Studio specific, but there is now a SharpDevelop specific NuGet package (EntityFramework.SharpDevelop) that allows you to use these PowerShell cmdlets in SharpDevelop. This has been made possible by Entity Framework being open sourced.
The EntityFramework.SharpDevelop NuGet package includes the original EntityFramework.dll along with custom versions of the assemblies containing the PowerShell cmdlets - EntityFramework.PowerShell.dll and EntityFramework.PowerShell.Utility.dll.
Now let us take a look at how to use the EntityFramework.SharpDevelop NuGet package.
Installation
Before you begin you should have SQL Express installed. You will also need SharpDevelop version 4.3.0.9134 or above.
We will look at using Entity Framework with a simple C# console application. This application will add a blog post to a SQL Express database and then read all the existing blog posts in the database.
In SharpDevelop first create a new C# Console Application. Now open the NuGet Manage Packages dialog by right clicking the project and selecting Manage Packages. Search for the EntityFramework.SharpDevelop package in the main NuGet feed and click the Add button to add it to your project. A reference to the EntityFramework assembly will be added to your project and your app.config will be modified.
Now we are ready to use Entity Framework to update and read from our database.
Using Entity Framework
First add a new Post class to your project.
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Text { get; set; }
}
Now add a new database context class.
public class BloggingContext : DbContext
{
public DbSet<Post> Posts { get; set; }
}
You will also need to add a using statement to the BloggingContext class so the EntityFramework's DbContext class can be found.
using System.Data.Entity;
Now open your Program.cs and add a using statement for System.Linq.
using System.Linq;
Then in Program.cs update the Main method as shown below:
class Program
{
public static void Main(string[] args)
{
Console.Write("Enter a post title: ");
string title = Console.ReadLine();
Console.Write("Enter the post text: ");
string text = Console.ReadLine();
using (var db = new BloggingContext()) {
var newPost = new Post {
Title = title,
Text = text
};
db.Posts.Add(newPost);
db.SaveChanges();
Console.WriteLine("All posts in the database:");
IQueryable<Post> query = db.Posts
.OrderBy(p => p.Title)
.Select(p => p);
foreach (Post post in query) {
Console.WriteLine("Post.Title: " + post.Title);
}
}
Console.WriteLine("Press a key to exit.");
Console.ReadKey();
}
}
This code reads the blog post title and text entered on the command line, adds a new post to the database and then reads all the posts in the database. Compile and run this application and you should see output similar to the following.
Enter a post title: First Post
Enter the post text: Some text here...
All posts in the database:
Post.Title: First Post
Press a key to exit.
After running this application Entity Framework will have created a new database with the same name as the db context class you created. In the screenshot below you can see the database open in SQL Server Express Management Studio.
You can see that Entity Framework has created a Posts table as well as a __MigrationHistory table. Now we will take a look at enabling database migrations.
Enabling Migrations
Open the Package Management Console and enter the command.
Enable-Migrations
This adds a Migrations folder to your project along with a Configuration.cs file and an initial migration.
The Configuration.cs file can be edited to add seed data and alter other settings used when migrating the database. The initial migration files contain code to generate the Posts table in the database.
Now let us take a look at adding a new migration.
Adding a Migration
We want to add a Published Date to our Post class. Add the new PublishedDate property to the Post class as shown below.
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Text { get; set; }
public DateTime PublishedDate { get; set; }
}
You can generate a code first migration by entering the following command into the Package Management Console.
Add-Migration AddPublishedDate
This creates a new migration and gives it the name AddPublishedDate. A new file will be added to your migrations folder which contains the code to update the Posts table with the new PublishedDate column.
namespace EFCodeFirst.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddPublishedDate : DbMigration
{
public override void Up()
{
AddColumn("dbo.Posts", "PublishedDate", c => c.DateTime(nullable: false));
}
public override void Down()
{
DropColumn("dbo.Posts", "PublishedDate");
}
}
}
Now you can update your database.
Updating the Database
To update the database we run the following command in the Package Management Console window.
Update-Database
The new PublishedDate column will then be added to the Posts database table as shown in the screenshot below
That concludes the introduction to using Code First Migrations with SharpDevelop. More information on EntityFramework can be found on the Microsoft MSDN site.
Changes Made to Original Entity Framework NuGet Packages
Renamed NuGet package to EntityFramework.SharpDevelop and included files and assemblies from official EF NuGet package.
Recompiled the EntityFramework.PowerShell and EntityFramework.PowerShell.Utility projects against SharpDevelop's EnvDTE implementation.
Small modifications to the project to compile against .NET 4.0 and the EntityFramework.dll. Microsoft's released source code on Codeplex is for EntityFramework 6 and not for EF 5.
EntityFramework.PowerShell and EntityFramework.PowerShell.Utility assemblies are no longer signed.
Added workaround to fix AppDomain.CreateInstance failing to find constructors taking a EnvDTE.Project parameter.
Add SharpDevelop.EnvDTE.dll to NuGet packages.
All the code for the modified NuGet packages are available on GitHub. [Less]
|
|
Posted
about 13 years
ago
by
MattWard
SharpDevelop 4.3 now has support for MVC Scaffolding.
MVC Scaffolding, maintained by Steve Sanderson, provides a way to quickly generate code for views and controllers in your ASP.NET MVC application. It has support for scaffolding the following:
... [More]
Views and controllers.
Entity Framework DbContexts.
Repositories.
Controller actions.
Unit tests.
It makes use of T4 templates, which can be customised, and can be extended with custom scaffolders to support more than just the features listed above.
The original MVC Scaffolding NuGet packages made heavy use of the Visual Studio API and have been modified to work with SharpDevelop. Full details of the changes made to the original NuGet packages can be found at the end of this post.
Steve Sanderson has a great series of posts on MVC Scaffolding that covers more than this post will. Now let us take a look at how to use MVC Scaffolding with SharpDevelop.
Installation
MVC Scaffolding for SharpDevelop is available as a NuGet package. The NuGet package you should download is MvcScaffolding.SharpDevelop. Install the MvcScaffolding.SharpDevelop NuGet package either from the NuGet package management console or by using the Manage Packages dialog.
Scaffolding a Controller and Views
As an example we will create a simple blogging site. Create a Razor MVC application called Blogging.Site. Then create the following class in a Models folder.
using System;
namespace BloggingSite.Models
{
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Text { get; set; }
public DateTime PublishedDate { get; set; }
}
}
Now we can scaffold a controller and a set of Create, Read, Update and Delete (CRUD) views. In the Package Management console run the following command.
Scaffold Controller Post
This will generate a set of views, a controller and an Entity Framework database context.
To run the Blogging Site application you will need to have IIS Express and SQL Server Express installed. Your project will also need to be configured to use IIS Express. Select Project Options from the Project menu and then select the Web tab. Choose IIS Express and then click the Create application/virtual directory button.
Then run your application and visit the /Posts page in your browser.
You can then create a new post by clicking the Create New link.
After creating a new post then the post will be displayed on the original /Posts page.
Also scaffolded is the details page which you can view by clicking the Details link.
Finally there is the Delete page where you can remove a post.
Scaffolding CRUD views is just one part of MvcScaffolding so let us take a look at some of other scaffolding that is supported. Steve Sanderson goes into more detail on what you can do with each of the MVC Scaffolders than will be covered here.
Scaffolding a Repository
The PostsController generated uses the BloggingSiteContext class which is derived from Entity Framework's DbContext.
public class PostsController : Controller
{
private BloggingSiteContext context = new BloggingSiteContext();
//
// GET: /Posts/
public ViewResult Index()
{
return View(context.Posts.ToList());
}
To allow unit testing of the controller we can instead using a repository interface which can be mocked. To do that we run the following command.
Scaffold Controller Post -Repository -Force
By default MVC Scaffolding will not overwrite views and controllers previously created in your project. In order to overwrite the views and controllers created previously we use the -Force option.
The PostsController now looks like this.
public class PostsController : Controller
{
private readonly IPostRepository postRepository;
// If you are using Dependency Injection, you can delete the following constructor
public PostsController() : this(new PostRepository())
{
}
public PostsController(IPostRepository postRepository)
{
this.postRepository = postRepository;
}
//
// GET: /Posts/
public ViewResult Index()
{
return View(postRepository.All);
}
Scaffolding an Empty View
You can scaffold an empty view by using the View scaffolder and specifying the name of the controller, without the Controller part, followed by the name of the view.
Scaffold View Posts MyEmptyView
In a Razor MVC application this will generate the file Views\Posts\MyEmptyView.cshtml in your project.
Scaffolding Database Context
You can scaffold extra properties for your database context by using the DbContext scaffolder and specifying the model class and the name of the database context class. If you create a new Blog class and run the command below a new Blogs property will be added to your BloggingSiteContext class.
Scaffold DbContext Blog BloggingSiteContext
The new BloggingSiteContext class is shown below.
public class BloggingSiteContext : DbContext
{
// You can add custom code to this file. Changes will not be overwritten.
//
// If you want Entity Framework to drop and regenerate your database
// automatically whenever you change your model schema, add the following
// code to the Application_Start method in your Global.asax file.
// Note: this will destroy and re-create your database with every model change.
//
// System.Data.Entity.Database.SetInitializer(
new System.Data.Entity.DropCreateDatabaseIfModelChanges
<BloggingSite.Models.BloggingSiteContext>());
public DbSet<BloggingSite.Models.Post> Posts { get; set; }
public DbSet<BloggingSite.Models.Blog> Blogs { get; set; }
}
Scaffolding Controller Actions
You can scaffold new controller actions by using the Action scaffolder and specifying the name of the controller, without the Controller part, and the name of the new action method.
Scaffold Action Posts MyAction
This will add a new MyAction method at the end of your PostsController class.
public ViewResult MyAction()
{
return View();
}
It will also create an associated view.
You can also scaffold actions that can have data posted to them. If you run the following command a new action will be created that takes a posted Blog object.
Scaffold Action Posts MyPostAction -ViewModel Blog -Post
The PostsController will now have a new MyPostAction method at the end.
[HttpPost, ActionName("MyPostAction")]
public ActionResult MyPostActionPost(Blog blog)
{
if (ModelState.IsValid) {
return RedirectToAction("Index");
} else {
return View(blog);
}
}
That is the end of our introduction to using MVC Scaffolding with SharpDevelop.
Modifications Made to Original MVC Scaffolding
Mvc Scaffolding projects now compiled against SharpDevelop's Package Management assembly which implements the Visual Studio API.
T4 template generation now uses MonoDevelop's T4 Templating Engine.
Source code for the modified MVC Scaffolding can be found on CodePlex. [Less]
|