Questions tagged [scaffolding]

Scaffolding is a meta-programming method of building database-backend software applications.

Scaffolding is a meta-programming method of building database-backend software applications. It is a technique supported by some model-view-controller frameworks (like Ruby on Rails, CodeIgniter, Spring Roo among many others) in which the programmer may write a specification that describes how the application database may be used. Some tool uses this specification to generate code to cover basic CRUD (Cread Read, Update, Delete) functionality, effectively treating the template as a scaffold on which to build a more powerful application. (View Wikipedia definition)

In many cases this scaffold can and has to be modified if we want to achieve more complex functionality and it's a reason why this feature is not recommended in complex sites.

Recently the term scaffolding has also been used for the use of pre-defined layouts or grids in CSS frameworks like Twitter-Bootstrap.

1070 questions
7
votes
1 answer

ASP.NET MVC: Accessing ModelMetadata for items in a collection

I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IEnumerable) and get back an HTML table that uses the DisplayName attribute for the headings (th…
devuxer
  • 41,681
  • 47
  • 180
  • 292
7
votes
3 answers

Scaffolding EntityFramework 6 Unable to cast object of type 'System.Data.Entity.Core.Objects.ObjectContext' to 'System.Data.Objects.ObjectContext'

I wanna use Scaffolding in EntityFrameWork 6, but get this: Unable to retrieve metadata for '[myNameSpace].Models.prod'. Unable to cast object of type 'System.Data.Entity.Core.Objects.ObjectContext' to type…
Mohammadreza
  • 3,139
  • 8
  • 35
  • 56
7
votes
1 answer

Ruby on Rails - generating column for textarea and pics

I am new to rails so excuse the simple questions. I am creating a website for a company. That company wants to display it's clients on the site. I would like to allow the client to manage this themselves. I am generating a table for the 'clients'…
bgadoci
  • 6,363
  • 17
  • 64
  • 91
7
votes
3 answers

Composite entity scaffolding in Ruby on Rails

I am new to Ruby on Rails. So far, I have only created CRUD operations by using scaffolding. Now, I need to integrate two entities into single form using scaffolding, not by hard coding it. How can we scaffold two entities together using script? I…
Okky
  • 10,338
  • 15
  • 75
  • 122
6
votes
2 answers

difference between: [ScaffoldColumn (false)] and [Display (AutoGenerateField = false)]

To render HTML in my edit view, I use the helper @Html.EditorForModel(). My model: [Required(ErrorMessage = "Campo obrigatório")] [Display(Name = "Nome completo")] public string Name { get; set; } [Required(ErrorMessage = "Campo é…
6
votes
2 answers

Rails: Handling a scaffolding, such as "Sheep," that has the same plural and singular form

I'm wanting to create a model called CommunicationMeans (or, alternatively, MeansOfCommunication). However, this is both the singular and plural form of this term. I ran this: $ rails g scaffold CommunicationMeans It generated a model named…
robertwbradford
  • 6,181
  • 9
  • 36
  • 61
6
votes
2 answers

How to generate service and repository layers for MVC3

I recently completed an MVC3 project for a client using a Repository pattern implemented using a micro ORM, and with a service layer for my business logic. IMHO the application works well and the client is happy. But I had to write a lot of…
David Clarke
  • 12,888
  • 9
  • 86
  • 116
6
votes
2 answers

How can I create my own C# Code Scaffolding Extension?

I am sure most of you are aware that you can use the Nuget package Microsoft.VisualStudio.Web.CodeGeneration.Design in your ASP.NET Core Web Api project to create Api controller classes with methods for GET, POST, PUT etc. and even Entity Framework…
6
votes
2 answers

MVC Scaffolding error: "Value cannot be null. Parameter name: source"

I followed the instruction in this post, but when I try to add a product I get this error: Server Error in '/' Application. -------------------------------------------------------------------------------- Value cannot be null. Parameter name:…
6
votes
2 answers

Entity Framework Core Scaffolding "Could not find type mapping for column with data type 'hierarchyid'. Skipping column"

I'm experimenting with .net core, entity framework and sqlserver, i thought the hierarchyID is a perfect datatype for what i'm trying to model. But when i scaffolded the database, EFC was not able to map the hierarchy. Could not find type mapping…
Red
  • 126
  • 1
  • 6
6
votes
1 answer

Define Scaffolding. (with respect to Dynamic Data and ASP.NET MVC)

There is a lot of information about how to implement and customize scaffolding with Dynamic Data and ASP.NET MVC. What exactly is the definition of scaffolding when used in this context?
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
6
votes
1 answer

Edit a Rails scaffold class to add a new field

I've generated a simple Rails 3 class using the scaffold function: rails generate scaffold Fattura data:date importo:integer descrizione:text Now I need to add another field in the class Fattura. What is the best way to do that?
Abramodj
  • 5,709
  • 9
  • 49
  • 75
6
votes
1 answer

How to get MvcScaffold to work with external models?

Steve Sanderson has a great blog that goes into the details of MvcScaffolding. See it here http://blog.stevensanderson.com/2011/01/13/mvcscaffolding-standard-usage/ He also has a great video on…
Razcer
  • 394
  • 4
  • 17
6
votes
3 answers

Create Entity Framework model based on an existing database in ASP.NET Core

I'm trying to create an Entity Framework model based on an existing database in ASP.NET Core. I can't make Scaffold-DbContext to work though! I have searched Stackoverflow and other websites to see if the packages in my ASP.NET Core Web Application…
6
votes
2 answers

Scaffold-DbContext throws error "Could not find assembly" in .net core

I am using .net core and entity framework core 1.1.0. while trying the following command in Package Manager Console Scaffold-DbContext "Server=MyServer\\MyInstance;Database=MyDB;user=MyUsername;password=MyDbPassword;"…
Pandiarajan
  • 410
  • 5
  • 14