Esempio n. 1
0
        private IDBView ClaimPermission(IDBSchema sch)
        {
            var ret = sch.AddView("ClaimPermission", new DBViewDescriptor()
            {
                Body =
                    @"SELECT 
	ID = newid(), t.ClaimID, t.PrincipalID, CanExecute = CAST(MAX(CAST(t.CanExecute AS INT)) AS BIT)
FROM
	(
		SELECT 
			PrincipalID, ClaimID, CanExecute
		FROM
			Common.PrincipalPermission pp

		UNION ALL

		SELECT 
			phr.PrincipalID, rp.ClaimID, rp.CanExecute
		FROM
			Common.RolePermission rp
			INNER JOIN Common.PrincipalHasRole phr ON rp.RoleID = phr.RoleID
	) t
GROUP BY
	t.PrincipalID, t.ClaimID"    ,
                WithSchemaBinding = false
            },
                                  new DBRevision(new DateTime(2016, 6, 10), 4, eDBRevisionType.Create));

            return(ret);
        }
Esempio n. 2
0
        private void vw_cus_cus_CustomView(IDBSchema sch)
        {
            var view = sch.AddView("vw_cus_cus_CustomView", new DBViewDescriptor()
            {
                WithSchemaBinding = true,
                Body =
                    @"SELECT 
    Broj = 1
"
            },
                                   new DBRevision(new DateTime(2016, 9, 20), 0, eDBRevisionType.Create));

            view.AddRevision(new DBRevision(new DateTime(2016, 9, 20), 1, eDBRevisionType.Modify),
                             new DBViewDescriptor()
            {
                WithSchemaBinding = false,
                Body =
                    @"SELECT 
    Broj = 2
"
            });
        }