Thursday, September 29, 2016

how to install windows 10 mobile aniversary update version 1607

You can find your Version Number in:
Settings/System/info

1507 orig. Windows 10
1511 November Update
1607 Aniversary Update

1) download Windows 10 upgrade advisor (Aktualisierungsratgeber für Windows 10)

Wednesday, September 28, 2016

c# .net Action / Func

Action ist ein delegate für eine Methode ohne Rückgabewert. Hier mit Expliziter (statt anaonymer) Methode:

Action<IBeforeChangeEntry<EntityBase>> updateAction = new Action<IBeforeChangeEntry<EntityBase>>(Trigger_Updating);
Triggers<EntityBase>.Updating += updateAction;

        private static void Trigger_Updating(IBeforeChangeEntry<EntityBase> obj)
        {
            obj.Entity.LastChanged = DateTime.Now;
            obj.Entity.Version += 1;
        }


Anonym:
            Triggers<EntityBase>.Updating += x =>
            {
                x.Entity.LastChanged = DateTime.Now;
                x.Entity.Version += 1;
            };

Tuesday, September 27, 2016

Visual Studio 2015 ASP.NET App Authentication

In VS2015 create new webform project, then a requester ask kind of Authentication and Application Type

Add a Foder LoggedInContent
add there a Web Config like:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?"/>
        </authorization>
    </system.web>
</configuration>

to protect all files in this folder - only authenticated users can access them
add Master Page Forms too the folder
add links from Default Page (available for everyone) to above added MasterPageSitesin LogedInContent

Wednesday, September 21, 2016

ef framework code first migrations with 2 DbContexts

enable-migrations -ContextTypeName EFTest.Model2 -MigrationsDirectory: Mig2
Add-migration -configuration EFTest.Mig2.Configuration Mig20001
update-database -configuration EFTest.Mig2.Configuration –Verbose

http://www.codeproject.com/Tips/801628/Code-First-Migration-in-Multiple-DbContext

only one context:
enable-migrations
Add-migration Mig0001
Update-Database

scripting triggers of sql server datatbase

right click on db, Tasks, generate scripts, next, advanced, table/view Options: Script Triggers = true

Monday, September 05, 2016

EF Update in Context existing Entities

there is a entity e1 in dbContext1, already loaded from database and its sent by server over WCF, changed byclient, sent back over WCF to server, its' not the same entity e1, its another object e2.
If you say Save to Context nothing is saved.
dbContext1 is the Ef Cache and should always contain the newest state of all objects


1) create a new context, attach the e2 and save it to database, update the dbContext 1 from database
2) update e1 with values (and references9 from e2, save to database with DbContext1
3) Detach e1 (set State to Detached)  and Attach e2, set e2. EnitytState to modified