//new DBMapper2<string, string, int>("ACE_Principal", -1, "PrincipalName", "SID"); private int PrincipalID(string pName, string pSID) { if (null == mapPrincipal) { mapPrincipal = new DBMapper2 <string, string, int>("ACE_Principal", -1, "PrincipalName", "SID"); } if (!PrincipalTableValidated) { var checker = new DBTableMaker("ACE_Principal"); checker.ForColumn("PrincipalName", "NVARCHAR(100)", true, true); checker.ForColumn("SID", "NVARCHAR(120)", true, true); RightsTableValidated = checker.ValidateTable(); } int id = mapPrincipal.ID(pName, pSID); return(id); }
//new DBMapper2<int, int, int>(tablename: "ACE_Principal_Rights", defaultvalue: -1, // nameparameter0: "PrincipalId", nameparameter: "RightsId"); private int AceDBID(int pNameID, int rightsID) { if (null == mapAceDb) // initialize this only if it will be used { mapAceDb = new DBMapper2 <int, int, int>(tablename: "ACE_Principal_Rights", defaultvalue: -1, nameparameter0: "PrincipalId", nameparameter: "RightsId"); } if (!AceDbTableValidated) { DBTableMaker checker = new DBTableMaker("ACE_Principal_Rights"); checker.ForColumn("PrincipalId", "INT", nullable: false, indexed: true); checker.ForColumn("RightsId", "INT", nullable: false, indexed: true); AceDbTableValidated = checker.ValidateTable(); } int id = mapAceDb.ID(pNameID, rightsID); return(id); }
//new DBMapper2<int, string, int>(tablename: "ACE_Rights", defaultvalue: -1, // nameparameter0: "Rights", nameparameter: "Description"); private int RightsID(FileSystemRights rights) { if (null == mapRights) { mapRights = new DBMapper2 <int, string, int>(tablename: "ACE_Rights", defaultvalue: -1, nameparameter0: "Rights", nameparameter: "Description"); } if (!RightsTableValidated) { DBTableMaker checker = new DBTableMaker("ACE_Rights"); checker.ForColumn("Rights", "INT", true, true); checker.ForColumn("Description", "NVARCHAR(120)", true, false); RightsTableValidated = checker.ValidateTable(); } var description = rights.ToString(); int rightsInt = (int)rights; int id = mapRights.ID(rightsInt, description); return(id); // throw new NotImplementedException(); }
private void TvpSetup() { if (tvpSetupDone) { return; } tvpSetupDone = true; const string makeTVP = "CREATE TYPE dbo.TVP_INT AS TABLE(id INT); "; const string makeTVPNVarChar = "CREATE TYPE dbo.TVP_NVARCHAR AS TABLE(name NVARCHAR(255)); "; var db = new DBTableMaker(); //if (!db.IfExists(tvpTypeInt)) if (!db.IfTypeExists(tvpTypeInt)) { var handlerBase = new SQLHandlerBase(); handlerBase.DoQueryNonScaler(makeTVP); } if (!db.IfTypeExists(tvpTypeNVarChar)) { var handlerBase = new SQLHandlerBase(); handlerBase.DoQueryNonScaler(makeTVPNVarChar); } }