打开和关闭Switchable优化

时间:2017-05-19 09:21:44

标签: mysql sql entity-framework command-line visual-studio-community

由于this issue,我必须关闭derived_merge优化标记,所以我从上面的链接开始:

set global optimizer_switch='derived_merge=OFF';

但我也想查看它的当前值...我怎么能通过命令行来做?

1 个答案:

答案 0 :(得分:0)

啊,我刚在official docs找到了它:)

以下是您的操作方法:

public List<string> UserInformation(string SAMAccountName)
    {
        try
        {
            DirectoryEntry ldapConnection = createDirectoryEntry();
            DirectorySearcher search = new DirectorySearcher(ldapConnection);

            search.Filter = "(sAMAccountName="+ SAMAccountName + ")";
            search.PropertiesToLoad.Add("displayName");
            search.PropertiesToLoad.Add("userPrincipalName");
            search.PropertiesToLoad.Add("description");
            search.PropertiesToLoad.Add("accountExpires");
            search.PropertiesToLoad.Add("memberOf");
            search.PropertiesToLoad.Add("profilePath");
            search.PropertiesToLoad.Add("objectSID");
            search.PropertiesToLoad.Add("anr");
            resultCollection = search.FindAll();
            //result = search.FindOne();
            foreach (SearchResult sr in resultCollection)
            {
                lastName.Add(sr.Properties["anr"][0].ToString());
                lastName.Add(sr.Properties["displayName"][0].ToString());
                lastName.Add(sr.Properties["userPrincipalName"][0].ToString());
                lastName.Add(sr.Properties["description"][0].ToString());
                lastName.Add(sr.Properties["accountExpires"][0].ToString());
                lastName.Add(sr.Properties["memberOf"][0].ToString());
                lastName.Add(sr.Properties["profilePath"][0].ToString());
                lastName.Add(sr.Properties["objectSID"][0].ToString());
            }

            return lastName;
        }
        catch(Exception e)
        {
            Console.WriteLine("Exception caught:\n\n" + e.ToString());
        }
        return null;
    }

}