Posts

Showing posts with the label Visual Studio 2015

Collapse All #regions Only(!) In C# (Visual Studio)

Answer : in Visual Studio 2017 I have to activate 'Collapse #regions when collapsing to definitions' in Tools -> Options -> Text Editor -> C# -> Advanced explicitly to collapse all when pressing Ctrl + M + O Ctrl + M + O will collapse all. Ctrl + M + L will expand all. (in VS 2013 - Toggle All outlining) Ctrl + M + P will expand all and disable outlining. Ctrl + M + M will collapse/expand the current section. These options are also in the context menu under Outlining. Right click in editor -> Outlining to find all options. (After disabling outlining, use same steps to enable outlinging.) The Visual Studio extension Productivity Power Tools 2015 from Microsoft has a feature called Quick Launch Tasks that adds new commands to the Quick Launch menu. One of them is CollapseRegions and it does exactly that. The opposite command is ExpandRegions and it expands all regions for quick browsing of the entire file. These commands can be used pre...

Can We Scaffold DbContext From Selected Tables Of An Existing Database

Answer : One can solve the problem by usage of dotnet ef dbcontext scaffold command with multiple -t ( --table ) parameters. It allows to specify all the tables, which needed by imported (scaffolded). The feature is described initially here. It is possible to specify the exact tables in a schema to use when scaffolding database and to omit the rest. The command-line examples that follow show the parameters needed for filtering tables. .NET Core CLI: dotnet ef dbcontext scaffold "server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -o sakila -t actor -t film -t film_actor -t language -f Package Manager Console in Visual Studio: Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -OutputDir Sakila -Tables actor,film,film_actor,language -f Force tag will update the existing selected models/files i...