本文整理汇总了C#中IObjectSpace类的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace类的具体用法?C# IObjectSpace怎么用?C# IObjectSpace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectSpace类属于命名空间,在下文中一共展示了IObjectSpace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDashBoard
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, bool filter)
{
var dashboard = new DevExpress.DashboardCommon.Dashboard();
try {
LoadFromXml(template.Xml, dashboard);
foreach (ITypeWrapper typeWrapper in template.DashboardTypes) {
ITypeWrapper wrapper = typeWrapper;
if (dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) {
Type dashBoardObjectType = DashBoardObjectType(template, dashboard, typeWrapper);
if (dashBoardObjectType != null) {
ITypeWrapper wrapper1 = typeWrapper;
var dataSource = dashboard.DataSources.First(ds => ds.Name.Equals(wrapper1.Caption));
dataSource.Data = GetObjects(objectSpace, dashBoardObjectType);
}
}
else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption)))
dashboard.DataSources.Add(new DashboardObjectDataSource(typeWrapper.Caption, GetObjects(objectSpace, typeWrapper.Type)));
}
if (filter)
Filter(template, dashboard);
}
catch (Exception e) {
dashboard.Dispose();
Tracing.Tracer.LogError(e);
}
return dashboard;
}
示例2: InitializeDefaultSolution
public static void InitializeDefaultSolution(IObjectSpace os)
{
var enumerable = ReflectionHelper.FindTypeDescendants(ReflectionHelper.FindTypeInfoByName(typeof(I单据编号).FullName));
var dictionary = os.GetObjects<单据编号方案>(null, true).ToDictionary(p => p.应用单据);
foreach (ITypeInfo info2 in enumerable)
{
if (!info2.IsAbstract && info2.IsPersistent)
{
var key = info2.Type;
单据编号方案 i单据编号方案 = null;
if (dictionary.ContainsKey(key))
{
i单据编号方案 = dictionary[key];
}
else
{
i单据编号方案 = os.CreateObject<单据编号方案>();
i单据编号方案.名称 = key.FullName;
i单据编号方案.应用单据 = info2.Type;
var item = os.CreateObject<单据编号自动编号规则>();
item.格式化字符串 = "00000";
i单据编号方案.编号规则.Add(item);
dictionary.Add(key, i单据编号方案);
}
}
}
os.CommitChanges();
}
示例3: Authenticate
public override object Authenticate(IObjectSpace objectSpace)
{
string systemUserName = WindowsIdentity.GetCurrent().Name;
string enteredUserName = ((AuthenticationStandardLogonParameters)LogonParameters).UserName;
if (string.IsNullOrEmpty(enteredUserName))
{
throw new ArgumentException(SecurityExceptionLocalizer.GetExceptionMessage(SecurityExceptionId.UserNameIsEmpty));
}
if (!String.Equals(systemUserName, enteredUserName))
{
throw new AuthenticationException(enteredUserName, "Invalid user name");
}
object user = objectSpace.FindObject(UserType, new BinaryOperator("UserName", systemUserName));
if (user == null)
{
user = objectSpace.CreateObject(UserType);
((IAuthenticationActiveDirectoryUser)user).UserName = systemUserName;
bool strictSecurityStrategyBehavior = SecurityModule.StrictSecurityStrategyBehavior;
SecurityModule.StrictSecurityStrategyBehavior = false;
objectSpace.CommitChanges();
SecurityModule.StrictSecurityStrategyBehavior = strictSecurityStrategyBehavior;
}
if (!((IAuthenticationStandardUser)user).ComparePassword(((AuthenticationStandardLogonParameters)LogonParameters).Password))
{
throw new AuthenticationException(systemUserName, SecurityExceptionLocalizer.GetExceptionMessage(SecurityExceptionId.RetypeTheInformation));
}
return user;
}
示例4: Authenticate
public override object Authenticate(IObjectSpace objectSpace) {
object user = objectSpace.FindObject(UserType, findUserCriteria);
if (user == null) {
throw new AuthenticationException(findUserCriteria.ToString());
}
return user;
}
示例5: AuthenticateActiveDirectory
private object AuthenticateActiveDirectory(IObjectSpace objectSpace) {
var windowsIdentity = WindowsIdentity.GetCurrent();
if (windowsIdentity != null) {
string userName = windowsIdentity.Name;
var user = (IAuthenticationActiveDirectoryUser)objectSpace.FindObject(UserType, new BinaryOperator("UserName", userName));
if (user == null) {
if (_createUserAutomatically) {
var args = new CustomCreateUserEventArgs(objectSpace, userName);
if (!args.Handled) {
user = (IAuthenticationActiveDirectoryUser)objectSpace.CreateObject(UserType);
user.UserName = userName;
if (Security != null) {
//Security.InitializeNewUser(objectSpace, user);
Security.CallMethod("InitializeNewUser", new object[]{objectSpace, user});
}
}
objectSpace.CommitChanges();
}
}
if (user == null) {
throw new AuthenticationException(userName);
}
return user;
}
return null;
}
示例6: CreateListView
public ListView CreateListView(XafApplication application, IObjectSpace objectSpace, ISupportSequenceObject supportSequenceObject) {
var nestedObjectSpace = (XPNestedObjectSpace)objectSpace.CreateNestedObjectSpace();
var objectType = XafTypesInfo.Instance.FindBussinessObjectType<ISequenceReleasedObject>();
var collectionSource = application.CreateCollectionSource(nestedObjectSpace, objectType, application.FindListViewId(objectType));
collectionSource.Criteria["ShowReleasedSequences"] = CriteriaOperator.Parse("TypeName=?", supportSequenceObject.Prefix + supportSequenceObject.ClassInfo.FullName);
return application.CreateListView(nestedObjectSpace, objectType, true);
}
示例7: CreateArtifact
private static ModuleArtifact CreateArtifact(ModuleChild moduleChild, ModuleArtifactType moduleArtifactType,IObjectSpace objectSpace, Type type){
var moduleArtifact = objectSpace.CreateObject<ModuleArtifact>();
moduleArtifact.Name = type.Name;
moduleArtifact.Type = moduleArtifactType;
moduleArtifact.ModuleChilds.Add(moduleChild);
return moduleArtifact;
}
示例8: Setup
public void Setup(IObjectSpace objectSpace, XafApplication application) {
if (helper == null) {
helper = new ObjectEditorHelper(MemberInfo.MemberTypeInfo, Model);
}
_application = application;
_objectSpace = objectSpace;
}
示例9: CreateDashBoard
public static DevExpress.DashboardCommon.Dashboard CreateDashBoard(this IDashboardDefinition template, IObjectSpace objectSpace, FilterEnabled filterEnabled) {
var dashboard = new DevExpress.DashboardCommon.Dashboard();
try {
if (!string.IsNullOrEmpty(template.Xml)) {
dashboard = LoadFromXml(template);
dashboard.ApplyModel(filterEnabled, template, objectSpace);
}
foreach (var typeWrapper in template.DashboardTypes.Select(wrapper => new { wrapper.Type, Caption = GetCaption(wrapper) })) {
var wrapper = typeWrapper;
var dsource = dashboard.DataSources.FirstOrDefault(source => source.Name.Equals(wrapper.Caption));
var objects = objectSpace.CreateDashboardDataSource(wrapper.Type);
if (dsource != null) {
dsource.Data = objects;
}
else if (!dashboard.DataSources.Contains(ds => ds.Name.Equals(wrapper.Caption))) {
dashboard.AddDataSource(typeWrapper.Caption, objects);
}
}
}
catch (Exception e) {
dashboard.Dispose();
Tracing.Tracer.LogError(e);
}
return dashboard;
}
示例10: CreateWizardView
public static void CreateWizardView(this ActionBaseEventArgs e, IObjectSpace objectSpace, object newObject, View sourceView){
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
e.ShowViewParameters.Context = "WizardDetailViewForm";
if (e.ShowViewParameters.CreatedView == null){
e.ShowViewParameters.CreatedView = e.Action.Application.CreateDetailView(objectSpace, newObject, sourceView);
}
}
示例11: StateMachineCollectionSource
public StateMachineCollectionSource(IObjectSpace objectSpace, IStateMachineRepository repository, Type type)
: base(objectSpace) {
_objectSpace = objectSpace;
_repository = repository;
_type = type;
objectTypeInfoCore = XafTypesInfo.Instance.FindTypeInfo(typeof(IStateMachine));
}
示例12: FilterWindowView
public FilterWindowView(IObjectSpace objectSpace, IModelView model, bool isRoot, List<FilterColumn> list)
: base(isRoot)
{
this.objectSpace = objectSpace;
base.model = model;
control = new FilterWindowControl(list);
}
示例13: CriteriaOperator_UserValueToString
private static void CriteriaOperator_UserValueToString(Object sender, UserValueProcessingEventArgs e)
{
if (!e.Handled && (e.Value != null))
{
ITypeInfo typeInfo = typesInfo.FindTypeInfo(e.Value.GetType());
if ((typeInfo != null) && typeInfo.IsPersistent)
{
IObjectSpace objectSpace = null;
if (e.Value is IObjectSpaceLink)
{
objectSpace = ((IObjectSpaceLink)e.Value).ObjectSpace;
}
if (objectSpace == null)
{
objectSpace = ParseCriteriaScope.currentObjectSpace;
}
if (objectSpace != null)
{
e.Data = objectSpace.GetObjectHandle(e.Value);
e.Tag = objectTag;
e.Handled = true;
}
else
{
e.Data = ObjectHandleHelper.CreateObjectHandle(typesInfo, typeInfo.Type, NHObjectSpace.GetKeyValueAsString(typesInfo, e.Value));
e.Tag = objectTag;
e.Handled = true;
}
}
}
}
示例14: XPObjectSpaceAwareControlInitializer
public XPObjectSpaceAwareControlInitializer(IXPObjectSpaceAwareControl control, IObjectSpace objectSpace)
{
Guard.ArgumentNotNull(control, "control");
Guard.ArgumentNotNull(objectSpace, "objectSpace");
control.UpdateDataSource(objectSpace);
objectSpace.Reloaded += (sender, args) => control.UpdateDataSource(objectSpace);
}
示例15: Download
/// <summary>
/// Downloads XafDelta messages into replication storage database.
/// </summary>
/// <param name="xafDeltaModule">The xaf delta module.</param>
/// <param name="objectSpace">The object space.</param>
/// <param name="worker">The worker.</param>
public void Download(XafDeltaModule xafDeltaModule, IObjectSpace objectSpace, ActionWorker worker)
{
worker.ReportProgress(Localizer.DownloadStarted);
var transportList = (from m in xafDeltaModule.ModuleManager.Modules
where m is IXafDeltaTransport && ((IXafDeltaTransport) m).UseForDownload
select m).Cast<IXafDeltaTransport>().ToList();
worker.ReportProgress(string.Format(Localizer.TransportFound, transportList.Count()));
foreach (var transport in transportList.TakeWhile(x => !worker.CancellationPending))
{
worker.ReportProgress(string.Format(Localizer.DownloadUsing, transport));
try
{
worker.ReportProgress(string.Format(Localizer.OpenTransport, transport));
transport.Open(TransportMode.Download, worker);
var existingReplicaNames = from c in objectSpace.GetObjects<Package>() select c.FileName;
var fileNames = transport.GetFileNames(worker,
@"(" + Ticket.FileMask + "|" + Package.FileMask + ")").ToList();
fileNames = fileNames.Except(existingReplicaNames).ToList();
worker.ReportProgress(string.Format(Localizer.FilesForDownload, fileNames.Count));
foreach (var fileName in fileNames.TakeWhile(x => !worker.CancellationPending))
{
// worker.ReportProgress(string.Format(Localizer.DownloadFile, fileName));
var fileData = transport.DownloadFile(fileName, worker);
if(fileData != null && fileData.Length > 0)
{
if (fileName.EndsWith(Package.PackageFileExtension))
{
var replica = Package.ImportFromBytes(objectSpace, fileName, fileData);
replica.Save();
}
else
{
var replicaTicket = Ticket.ImportTicket(objectSpace, fileData);
replicaTicket.Save();
}
if (!fileName.Contains(ReplicationNode.AllNodes))
transport.DeleteFile(fileName, worker);
objectSpace.CommitChanges();
}
}
}
catch (Exception exception)
{
objectSpace.Rollback();
worker.ReportError(Localizer.DownloadError, exception.Message);
}
finally
{
worker.ReportProgress(Localizer.CloseTransport, transport);
transport.Close();
}
}
worker.ReportProgress(Color.Blue, Localizer.DownloadFinished);
}