Archive for the ‘developing’ Category

NuGet CommandLine

Posted: December 18, 2018 in NuGet, Uncategorized
Tags: ,

nuget commands

// to install nuget
Install-Package NuGet.CommandLine

// restore packages
.nuget/nuget.exe restore

// update and Reinstall All packages (the best! solves the most frequent cases of errors)
Update-Package -Reinstall

Advertisements

Migrations Commands

Posted: December 18, 2018 in migrations, Uncategorized

Favorite:
View Script: Update-Database -Script -SourceMigration:0

——————————–

Enable-Migrations
Enables Code First Migrations in a project.

Syntax
Enable-Migrations [-ContextTypeName ] [-EnableAutomaticMigrations]
[-MigrationsDirectory ] [-ProjectName ] [-StartUpProjectName ]
[-ContextProjectName ] [-ConnectionStringName ] [-Force]
[-ContextAssemblyName ] [-AppDomainBaseDirectory ] []

Enable-Migrations [-ContextTypeName ] [-EnableAutomaticMigrations]
[-MigrationsDirectory ] [-ProjectName ] [-StartUpProjectName ]
[-ContextProjectName ] -ConnectionString
-ConnectionProviderName [-Force] [-ContextAssemblyName ]
[-AppDomainBaseDirectory ] []
Description
Enables Migrations by scaffolding a migrations configuration class in the project. If the target database was created by an initializer, an initial migration will be created (unless automatic migrations are enabled via the EnableAutomaticMigrations parameter).

—————–

Add-Migration
Scaffolds a migration script for any pending model changes.

Syntax
Add-Migration [-Name] [-Force] [-ProjectName ] [-StartUpProjectName ]
[-ConfigurationTypeName ] [-ConnectionStringName ] [-IgnoreChanges]
[-AppDomainBaseDirectory ] []

Add-Migration [-Name] [-Force] [-ProjectName ] [-StartUpProjectName ]
[-ConfigurationTypeName ] -ConnectionString -ConnectionProviderName
[-IgnoreChanges] [-AppDomainBaseDirectory ] []

—————–

Update-Database
Applies any pending migrations to the database.

Syntax
Update-Database [-SourceMigration ] [-TargetMigration ] [-Script] [-Force]
[-ProjectName ] [-StartUpProjectName ] [-ConfigurationTypeName ]
[-ConnectionStringName ] [-AppDomainBaseDirectory ] []

Update-Database [-SourceMigration ] [-TargetMigration ] [-Script] [-Force]
[-ProjectName ] [-StartUpProjectName ] [-ConfigurationTypeName ]
-ConnectionString -ConnectionProviderName
[-AppDomainBaseDirectory ] []
Description
Updates the database to the current model by applying pending migrations.

Parameters
-SourceMigration
Only valid with -Script. Specifies the name of a particular migration to use as the update’s starting point. If ommitted, the last applied migration in the database will be used.

-TargetMigration
Specifies the name of a particular migration to update the database to. If ommitted, the current model will be used.

-Script
Generate a SQL script rather than executing the pending changes directly.

-Force
Specifies that data loss is acceptable during automatic migration of the database.

-ProjectName
Specifies the project that contains the migration configuration type to be used. If ommitted, the default project selected in package manager console is used.

-StartUpProjectName
Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

-ConfigurationTypeName
Specifies the migrations configuration to use. If omitted, migrations will attempt to locate a single migrations configuration type in the target project.

-ConnectionStringName
Specifies the name of a connection string to use from the application’s configuration file.

-ConnectionString
Specifies the the connection string to use. If omitted, the context’s default connection will be used.

-ConnectionProviderName
Specifies the provider invariant name of the connection string.

-AppDomainBaseDirectory
Specifies the directory to use for the app-domain that is used for running Migrations code such that the app-domain is able to find all required assemblies. This is an advanced option that should only be needed if the solution contains several projects such that the assemblies needed for the context and configuration are not all referenced from either the project containing the context or the project containing the migrations.

EF Designer Code Generation Templates

Profiling Database Activity in the Entity Framework

View query generated in Linq

Posted: August 19, 2014 in c#, debug, entity framework, linq, sql
Tags: , , ,
///Code below:
var result = from x in appEntities
             where x.id = 32
             select x;

var sql = ((System.Data.Objects.ObjectQuery)result).ToTraceString();

Code:
http://stackoverflow.com/a/1412902

codeshow()

Posted: August 19, 2014 in Windows
Tags: , ,

Project Description

This is a Windows 8 HTML/JS project with the express goal of demonstrating simple development concepts for the Windows 8 platform. You may learn some stuff about end-to-end app architecture by looking at the source code of codeShow, but the primary goal of the project is to help you learn discrete programming tasks such as accessing the camera, implementing an asymmetric ListView, or handling errors look to codeShow.
To see what’s new with codeShow, visit the news page.

 

More…

http://codeshow.codeplex.com/

Other publish