Skip to content

Commit a4bf27b

Browse files
authored
Make SIDs optional for Login (#78)
1 parent 8b0804f commit a4bf27b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/SmoFacade/Login.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ private static Microsoft.SqlServer.Management.Smo.Login ConstructLogin(LoginProp
104104
{
105105
var login = new Microsoft.SqlServer.Management.Smo.Login(server._server, loginProperties.Name) {
106106
LoginType = loginProperties.LoginType,
107-
Sid = loginProperties.Sid,
108107
DefaultDatabase = loginProperties.DefaultDatabase
109108
};
110109

111-
if(loginProperties.LoginType == LoginType.SqlLogin) {
110+
if (loginProperties.Sid != null)
111+
{
112+
login.Sid = loginProperties.Sid;
113+
}
114+
115+
if (loginProperties.LoginType == LoginType.SqlLogin) {
112116
if(loginProperties.PasswordHash != null)
113117
login.Create(loginProperties.PasswordHash, LoginCreateOptions.IsHashed);
114118
else if(loginProperties.Password != null)

0 commit comments

Comments
 (0)