本文整理汇总了C#中IObjectSpace.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace.GetObject方法的具体用法?C# IObjectSpace.GetObject怎么用?C# IObjectSpace.GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectSpace
的用法示例。
在下文中一共展示了IObjectSpace.GetObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateActionArtifacsts
private void CreateActionArtifacsts(IObjectSpace objectSpace, RuntimeSetupInfo setupInfo) {
if (!objectSpace.Contains<ModuleArtifact>(artifact => artifact.Type == ModuleArtifactType.Action)) {
var moduleTypes = GetModuleTypes(setupInfo);
var controllers = moduleTypes.SelectMany(type => type.Assembly.GetTypes())
.Where(type => !type.IsAbstract && typeof(Controller).IsAssignableFrom(type))
.Select(type => type.CreateInstance())
.Cast<Controller>();
foreach (var controller in controllers) {
var controllerArtifact = objectSpace.GetModuleArtifact(controller.GetType());
foreach (var action in controller.Actions) {
var name = action.Id;
var actionArtifact = objectSpace.GetObject<ModuleArtifact>(artifact => artifact.Name == name && artifact.Type == ModuleArtifactType.Action);
actionArtifact.Name = name;
actionArtifact.Type = ModuleArtifactType.Action;
actionArtifact.Text = action.ToolTip;
actionArtifact.ModuleChilds.AddRange(controllerArtifact.ModuleChilds);
actionArtifact.Artifacts.Add(controllerArtifact);
controllerArtifact.Artifacts.Add(actionArtifact);
}
}
}
}
示例2: GetExtendedInterface
private static ExtendedInterface GetExtendedInterface(IObjectSpace objectSpace,Type extendedInterface) {
var extendedInterface1 = objectSpace.GetObject<ExtendedInterface>(@interface => @interface.Name == extendedInterface.Name) ;
extendedInterface1.Name = extendedInterface.Name;
return extendedInterface1;
}
示例3: CreateNewExamination
/// <summary>
/// Метод создает в БД новое обследование
/// </summary>
private IExamination CreateNewExamination(IObjectSpace os, IPatient patient, Guid id, ExaminationType type = null, bool allowEmptyFile = false)
{
IExamination examination = os.CreateObject<IExamination>();
examination.ExaminationSoftType = os.FindObject<ExaminationSoftType>(CriteriaOperator.Parse("ExaminationSoftTypeId = ?", id));
examination.Patient = os.GetObject<IPatient>(patient);
examination.AllowEmptyOrNotExistsFile = allowEmptyFile;
examination.TimeStart = DateTime.Now;
// Создается новое обследование поэтому файла еще нет
if (examination.ExaminationFile == null)
{
// заводим в базе файл
//examination.ExaminationFile = os.CreateObject<FileSystemStoreObject>();
examination.ExaminationFile = os.CreateObject<ExaminationFile>();
examination.ExaminationFile.OwnerId = (examination as DevExpress.ExpressApp.DC.DCBaseObject).Oid;
if (type != null)
{
examination.ExaminationType = os.GetObjectByKey<ExaminationType>(type.Oid); //FindObject<ExaminationType>(CriteriaOperator.Parse("ExaminationTypeId = ?", type.));
}
// Применяем изменения
os.CommitChanges();
if (String.IsNullOrEmpty(examination.ObjectCode) == false)
{
string fileName = examination.ObjectCode;
string fileExtension = examination.ExaminationSoftType.ExaminationFileExtension;
examination.ExaminationFile.FileName = Converters.GetFileNameWithoutInvalidChars(fileName, fileExtension);
}
else
throw new Exception("Examination invalid params");
}
os.CommitChanges(); // здесь создается пустой файл обследования
while (os.IsCommitting) { Thread.Sleep(1000); } // ждем пока применятся изменения, не знаю зачем...
//// Заполняем созданный файл заключения
//// !!! ЗАПОЛНЯТЬ ЗАКЛЮЧЕНИЕ ПРИ СОЗДАНИИ НЕ НАДО !!!
//ConclusionViewController conclusionController = Frame.GetController<ConclusionViewController>();
//if (conclusionController != null)
//{
// conclusionController.PopulateConclusionFile(examination);
//}
return examination;
}
示例4: Authenticate
public override object Authenticate(IObjectSpace objectSpace)
{
var customLogonParameters = logonParameters as CustomLogonParameters;
if (customLogonParameters.Employee == null)
{
var message = CaptionHelper.GetLocalizedText("Exceptions", "CustomAuthenticationExceptionEmployeeNull");
throw new UserFriendlyException(message);
}
if (customLogonParameters.Employee.ComparePassword(customLogonParameters.Password) == false)
{
var message = CaptionHelper.GetLocalizedText("Exceptions", "CustomAuthenticationExceptionPasswordMismatch");
throw new AuthenticationException(customLogonParameters.Employee.UserName, message);
}
return objectSpace.GetObject(customLogonParameters.Employee);
}