C#?????????????8??????
???????????? ???????[ 2013/6/20 10:55:24 ] ????????
???????????е?????????????洦????????????????Щ??????????????????????????Щ????????????????????????????????????????????????????ò???????????????????У???????????????????????
?????????о?????????????????????ο???
????1????????????????μ??????У??????????????????????????
//public void ExecuteSqlCommand(string sqlCommandText)
//{
//this.ExecuteSqlCommand(sqlCommandText?? CommandType.Text?? null);
//}
......
????ExecuteSqlCommand???????????????μ????????SqlHelper?У????????????????????????????????п????????????????????????????????????????????2????????????μ?????
????2??????????????????????????????????????????????????
static ClientProxyFactory()
{
_managerTypeAssemblies = new List<string>();
_managerTypesCache = new Dictionary<string?? Type>();
_managerInstancesCache = new Dictionary<string?? IManagerBase>();
EnableManagerInstanceCache = true;
//if (Platform == CommunicationPlatform.Local)
//{
// foreach (string file in ManagerAssembly)
// {
// if (File.Exists(String.Format("{0}.dll"?? file)))
// {
// Assembly assembly = Assembly.Load(file);
// _managerTypeAssemblies.Add(assembly);
// }
// }
//}
}
......
???????????????У?CommunicationPlatform?Local?????????????????????????????????????????????????????_managerTypeAssemblies?????С??????????????????????????Local??????????.net Remoting??????????δ????????
????3??????????????????′??????????????檔????????????????????£?????????????
????????????????????????????壬??????????t????????????????????t??????????
/// <summary>
/// ????????????
/// </summary>
/// <param name="file"></param>
/// <param name="typeName"></param>
/// <param name="methodName"></param>
/// <returns></returns>
public static object InvokeStaticMethod(Type typeName??string methodName??object [] args)
{
//Assembly assembly = Assembly.LoadFile(file);
//Type type = assembly.GetType(typeName);
Assembly assembly = typeName.Assembly;
//obj2 = Activator.CreateInstance(type?? args);
System.Reflection.MethodInfo method = typeName.GetMethod(methodName??new Type[]{ typeof(object)});
// object obj= assembly.CreateInstance(typeName);
// object obj = Activator.CreateInstance(typeName?? args);
return typeName.InvokeMember(methodName?? BindingFlags.Public | BindingFlags.Static?? null?? null?? args);
}
public static object GetStaticPropertyValue(Type type?? string propertyName)
{
object objec=CreateObjectInstance(type);
PropertyInfo propertyInfo = type.GetProperty(propertyName??BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
//type.GetProperty(propertyName).GetValue(null?? null);
return propertyInfo.GetValue(objec?? null);
}
?????????汻????????п???????????????????????????????????????????????????????????????????????У???????????????????£???б???????????????С????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????е?????г???????????
??????????????????????????????ü????????????????????????????з???????е??????÷??????ReflectionHelper?????У???????????????????????????????????д????ɡ?
????4?????????????????′????в?????????????
?????????????????????????????????????
//bakup file
public static BackupFile(string sourceFileName?? string destFileName)
{
try
{
System.IO.File.Copy(sourceFileName?? destFileName?? true);
return true;
}
catch (Exception e)
{
throw e;
}
}
public static void CopyDirectory(string oldDir?? string newDir)
{
try
{
DirectoryInfo dInfo = new DirectoryInfo(oldDir);
CopyDirInfo(dInfo?? oldDir?? newDir);
}
catch (Exception exc)
{
throw new Exception(exc.ToString());
}
}
????????????????true/false?????????????г??????????????????????????????????????????????????б????????????????????????????CopyDirectory?У?????????????????????????????±???????????????WinForms??????????????????????
CustomExceptionHandler eh = new CustomExceptionHandler();
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CustomExceptionHandler.CurrentDomain_UnhandledException);
Application.ThreadException += new ThreadExceptionEventHandler(eh.OnThreadException);
????????????????????UnhandledException ??ThreadException ?????????????????з???????????????????????????????????????????????????????????????????????
/// <summary>
/// ??????????????????????????????
/// </summary>
/// <param name="oldFile">????</param>
/// <param name="newFile">??????</param>
public static void CopyFile(string oldFile?? string newFile)
{
try
{
File.Copy(oldFile?? newFile?? true);
}
catch (Exception exc)
{
throw new Exception(exc.ToString());
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11