Skip to content

Instantly share code, notes, and snippets.

View sovanesyan's full-sized avatar

Serge Ovanesyan sovanesyan

View GitHub Profile
/* This is a template command. */
CmdUtils.CreateCommand({
name: "kino",
/*icon: "http://example.com/example.png",
homepage: "http://example.com/",
author: {name: "Your Name", email: "you@example.com"},
license: "GPL",
description: "A short description of your command",
help: "How to use your command",
XmlMetadataSource source = XmlMetadataSource.FromAssemblyResource("Northwind.rlinq");
var model = source.GetModel();
var productType = model.PersistentTypes.FirstOrDefault(x => x.Name == "Product");
productType.OptimisticConcurrencyControlStrategy = OptimisticConcurrencyControlStrategy.Timestamp;
//Making sure there is no cached database.
Database.Get("NorthwindEntityDiagrams", new BackendConfiguration() { Backend = "mssql" }, model).Dispose();
//initialize the database with the modified metadata
@sovanesyan
sovanesyan / gist:2036680
Created March 14, 2012 14:03
Execute OpenAccess validation
//Create a FluentMetadataSource and retrieve the MetadataContainer from it.
Source source = new Source();
MetadataContainer model = source.GetModel();
//We are passing in false in order to specify no resolution actions should be added.
//A resolution action is a proposed by the rule fix for the problem and pops up in the designer.
MetaModelValidation validation = new MetaModelValidation(false);
//Specify the custom validation rule provider
validation.ValidationRuleProvider = new SitefinityValidationProvider();
public interface IUnitOfWork
{
void Delete(object entity);
void SaveChanges();
void ClearChanges();
void Add(object entity);
@sovanesyan
sovanesyan / gist:3180872
Created July 26, 2012 08:02
Nuget Package Add Import and Errors
# Need to load MSBuild assembly if it's not loaded yet.
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
# Grab the loaded MSBuild project for the project
$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1
# Make the path to the targets file relative.
$projectUri = new-object Uri('file://' + $project.FullName)
$targetUri = new-object Uri('file://' + $targetsFile)
$relativePath = $projectUri.MakeRelativeUri($targetUri).ToString().Replace([System.IO.Path]::AltDirectorySeparatorChar, [System.IO.Path]::DirectorySeparatorChar)
$existsCondition = "Exists('" + $relativePath + "')"
// на пръв поглед един блок
public SqlExpressionVisitor() {
modelDef = typeof(T).GetModelDefinition();
PrefixFieldWithTableName = false;
WhereStatementWithoutWhereString = false;
}
// ясно разделение между заглавие и съдържание
public SqlExpressionVisitor()
{
var logger = new ILogger();
// Shortcut with just a message
logger.Error("Something bad happened");
// Shortcut for type
logger.Error(entry => entry.Message("Too many Cordova plugins used")
- restore_cache:
keys:
- recorder-{{ .Branch }}
paths:
- /caches/app.tar
- run:
name: Load Docker image layer cache
command: |
set +o pipefail
docker load -i /caches/app.tar | true