| 2BA | My
Snippets
We've recently added code snippets to help our developers write code more efficiently.
Before you can get started with snippets, you need to inform Visual Studio where to find our snippets. Follow the steps below if you're unsure how to do that.
-
Open the
Tools
tab in Visual Studio and selectCode Snippets Manager
(default shortcut:ctrl + k, ctrl + b
). - Choose a language from the first drop-down list. Currently, we only have snippets for C# and HTML code.
-
Add the folder with our snippets. Locate the Online solution, navigate to the
CDN
project, and look for a folder named2BASnippets
. Select this folder. -
Click
OK
, and you're done! Access our snippets using the default shortcutctrl + k, ctrl + x
.
That's it. You're done!
You can now use our latest snippets as long as you keep your solution up-to-date!
All Snippets We Currently Have
csharp
protected $datatype$ $name$($parameters$)
{
$end$
}
csharp
public ActionResult $Index$()
{
$end$
return View();
}
csharp
$dataBasePath$.Db.Management.ExecuteOnConnection(conn => conn.$executeMethod$<$type$>($query$, $parameters$));
html
<div class="modal-dialog">
<div class="modal-content">
@using (Html.BeginForm("ACTION", "CONTROLLER", null, FormMethod.Post, new { role = "form", @id = "formChange" }))
{
<div class="modal-header">
<button type="button" data-dismiss="modal" aria-hidden="true" class="close md-close"><i class="fal fa-times"></i></button>
<h3 class="modal-title">$title$</h3>
</div>
<div class="modal-body">$end$
</div>
<div class="modal-footer">
<input type="submit" value="@Generic.Resources.Common.Button.Save" class="btn btn-primary" name="submitButton">
<button type="submit" class="btn btn-default" data-dismiss="modal">@Generic.Resources.Common.Button.Cancel</button>
</div>
}
</div>
</div>
html
<div class="panel panel-default">
<div class="panel-heading">
<span class="panel-title">$Title$</span>
</div>
<div class="panel-body">$end$
</div>
</div>
html
<table class="table table-striped datatable-mvc" data-paneltype="@PanelType.$Panel$" data-defaultorder="$defaultOrder$" data-hidecolumns="$hideColumns$" data-disablesort="$disableSort$" data-disablesearch="$disableSearch$">
</table>
html
@using (Html.BeginForm("ACTION", "CONTROLLER", null, FormMethod.Post, new { role = "form", @id = "formChange" }))
{
$Content$
}
html
<div class="alert alert-danger alert-icon alert-border-color" role="alert">
<div class="icon"><span class="fal fa-exclamation-triangle"></span></div>
<div class="message">$selected$ $end$
</div>
</div>
html
<div class="alert alert-info alert-icon alert-border-color" role="alert">
<div class="icon"><span class="fal fa-info-circle"></span></div>
<div class="message">$selected$ $end$
</div>
</div>
html
<div class="alert alert-primary alert-icon alert-border-color" role="alert">
<div class="icon"><span class="fal fa-check"></span></div>
<div class="message">$selected$ $end$
</div>
</div>
html
<div class="alert alert-success alert-icon alert-border-color" role="alert">
<div class="icon"><span class="fal fa-check"></span></div>
<div class="message">$selected$ $end$
</div>
</div>
html
<div class="alert alert-warning alert-icon alert-border-color" role="alert">
<div class="icon"><span class="fal fa-exclamation-triangle"></span></div>
<div class="message">$selected$ $end$
</div>
</div>
html
<span class='fa fa-spinner fa-spin'></span> <span class='loadtext'>Loading</span>
sql
CASE $expression$
WHEN $val$ THEN $end$
ELSE 'Other'
END
sql
IF( $Condition$ )
BEGIN
$end$
END