getting started scaffolding - AlienEngineer/VirtualObjects GitHub Wiki

Getting Started (Scaffolding)

This first version of the Scaffold only supports SqlServer.


// Creates all models based on the given data source.
Scaffold Models <SqlServer> <Database>

// Scaffold Switchs to change behavior
    -Repository						(Creates a Repository layer of abstraction)
    -TableName <TableName>			(Create the entity model of a single table)
    -NoLazyLoad						(Doesn't create virtual members)
    -ForceAnnotations				(Every field gets an annotation)
    -DefaultAttributes				(Use the default VirtualObjects.Mapping namespace)
	-DontConfig						(Doesn't change the .Config connection string)
	-ModelFolder <FolderName>		(By default: Models)
	-RepositoryFolder <FolderName>	(By default: Repositories)
	-AnnotationsFolder <FolderName>	(By default: Annotations)
	-ToFolder <FolderName>			(By default: Scaffolds into a folder)

What will be created and changed.

  • The scaffolder will create the entity models based on the database provided.
  • If the -Repository is present a Repository layer is created. With the proper custom configuration for the entity models. And also add:
    • Annotations\Annotations.cs with all the custom attributes needed to map the entities.
    • Repositories\IRepository.cs interface.
    • Repositories\Repository.cs class that implements IRepository.
    • The proper configuration to use the custom attributes.
    • RepositoryExtensions.cs with some helpfull extensions for the new IRepository interface.
  • Since we are giving it the server and the database it will change the App.Config or Web.Config connectionStrings

// Creates the RepositoryLayer
Scaffold Repository

// Scaffold Switchs to change behavior
	-ModelFolder <FolderName>		(By default: Models)
	-RepositoryFolder <FolderName>	(By default: Repositories)
	-AnnotationsFolder <FolderName>	(By default: Annotations)
	-ToFolder <FolderName>			(By default: Scaffolds into a folder)

What will be created and changed.

  • The scaffolder will create a Repository layer with the proper custom configuration for the entity models. And also add:
    • Annotations\Annotations.cs with all the custom attributes needed to map the entities.
    • Repositories\IRepository.cs interface.
    • Repositories\Repository.cs class that implements IRepository.
    • The proper configuration to use the custom attributes.
    • RepositoryExtensions.cs with some helpfull extensions for the new IRepository interface.

// Sets the configuration string
Scaffold Config <ServerName> <DataBase>
	-ProviderName		(Use a different Provider)
	-ConfigName			(Change the configuration of the given name)

What will be created and changed.

  • The scaffolder will change the App.Config or Web.Config connectionStrings.

// Creates the BusinessLayer
Scaffold Business <ModelType>
	-ModelFolder <FolderName>		(By default: Models)
	-BusinessFolder <FolderName>	(By default: Business)
	-ToFolder <FolderName>			(By default: Scaffolds into a folder)
	-NoDelete						(Business doesn't support delete operations)
	-NoInsert						(Business doesn't support insert operations)
	-NoUpdate						(Business doesn't support update operations)
	-ReadOnly						(Business for read operations only)

What will be created and changed.

  • The scaffolder will create:
    • An Interface for the ModelType Business Layer
    • An Interface implementation.
⚠️ **GitHub.com Fallback** ⚠️