public static IOguObject CreateWrapperObject(string id, SchemaType type) { IOguObject result = null; switch (type) { case SchemaType.Organizations: result = new OguOrganization(id); break; case SchemaType.Users: result = new OguUser(id); break; case SchemaType.Groups: result = new OguGroup(id); break; default: ExceptionHelper.TrueThrow(true, string.Format("SchemaType错误{0}", type)); break; } return(result); }
public static IOguObject CreateWrapperObject(IOguObject obj) { IOguObject result = null; if (obj is OguBase || obj == null) { result = obj; } else { if (obj is IUser) { result = new OguUser((IUser)obj); } else if (obj is IOrganization) { result = new OguOrganization((IOrganization)obj); } else if (obj is IGroup) { result = new OguGroup((IGroup)obj); } else { ExceptionHelper.TrueThrow(true, "不能生成类型为{0}的对象人员包装类", obj.GetType().Name); } } return(result); }