public static bool CreateFolder(MappingInfo mapping, string title, string tcmContainer)
        {
            if (!EnsureValidClient(mapping))
                return false;

            try
            {
                FolderData folderData = new FolderData
                {
                    Title = title,
                    LocationInfo = new LocationInfo { OrganizationalItem = new LinkToOrganizationalItemData { IdRef = tcmContainer } },
                    Id = "tcm:0-0-0"
                };

                folderData = Client.Save(folderData, new ReadOptions()) as FolderData;
                if (folderData == null)
                    return false;

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
Пример #2
0
 /// <summary>
 /// 인자에 맞는 <see cref="UnitOfWorkTestContext"/>의 인스턴스를 빌드한다.
 /// </summary>
 /// <param name="containerConfigPath">IoC 환경설정 파일경로</param>
 /// <param name="dbStrategy">테스트용 DB 생성 전략</param>
 /// <param name="mappingInfo">NHibernate용 Entity 정보</param>
 /// <returns>테스트용 UnitOfWork</returns>
 /// <param name="configAction">추가 환경설정 작업용 델리게이트</param>
 /// <param name="conventions">명명규칙</param>
 public static UnitOfWorkTestContext FluentFor(string containerConfigPath,
                                               UnitOfWorkTestContextDbStrategy dbStrategy,
                                               MappingInfo mappingInfo,
                                               Action<NHibernate.Cfg.Configuration> configAction,
                                               params IConvention[] conventions) {
     return new FluentNHUnitOfWorkTestContext(dbStrategy, containerConfigPath, mappingInfo, configAction, conventions);
 }
 public ARUnitOfWorkTestContext(
     UnitOfWorkTestContextDbStrategy dbStrategy,
     string rhinoContainerConfigPath,
     MappingInfo assemblies)
     : base(dbStrategy, rhinoContainerConfigPath, assemblies)
 {
 }
Пример #4
0
 /// <summary>
 /// 인자에 맞는 <see cref="UnitOfWorkTestContext"/>의 인스턴스를 빌드한다.
 /// </summary>
 /// <param name="container">Container</param>
 /// <param name="dbStrategy">테스트용 DB 생성 전략</param>
 /// <param name="mappingInfo">NHibernate용 Entity 정보</param>
 /// <param name="configAction">추가 환경설정 작업용 델리게이트</param>
 /// <returns>테스트용 UnitOfWork</returns>
 public static UnitOfWorkTestContext For(IWindsorContainer container,
                                         UnitOfWorkTestContextDbStrategy dbStrategy,
                                         MappingInfo mappingInfo,
                                         Action<NHibernate.Cfg.Configuration> configAction) {
     var context = For(string.Empty, dbStrategy, mappingInfo, configAction);
     context._container = container;
     return context;
 }
 public FluentNHUnitOfWorkTestContext(UnitOfWorkTestContextDbStrategy dbStrategy,
                                      string windsorConfigPath,
                                      MappingInfo mappingInfo,
                                      Action<Configuration> configAction,
                                      params IConvention[] conventions)
     : base(dbStrategy, windsorConfigPath, mappingInfo, configAction) {
     _conventions = conventions;
 }
		public static UnitOfWorkTestContext For(PersistenceFramework framwork,
                                                IWindsorContainer container,
                                                UnitOfWorkTestContextDbStrategy dbStrategy,
                                                MappingInfo mappingInfo)
		{
			UnitOfWorkTestContext context = For(framwork, string.Empty, dbStrategy, mappingInfo);
			context.rhinoContainer = container;
			return context;
		}
 /// <summary>
 /// Initialize the persistence framework, build a session factory, and
 /// initialize the container. If <paramref name="rhinoContainerConfig"/>
 /// is <see langword="null" /> or <see cref="string.Empty">string.Empty</see>
 ///  a <see cref="RhinoContainer">RhinoContainer</see> will not be initialized.
 /// </summary>
 /// <param name="framework">The persistence framework</param>
 /// <param name="rhinoContainerConfig">The configuration file to initialize a 
 /// <see cref="RhinoContainer">RhinoContainer</see> or <see langword="null" />.</param>
 /// <param name="databaseName">Name of the database or <see langword="null" />.</param>
 /// <param name="databaseEngine">The database engine that tests should be performed against</param>
 /// <param name="mappingInfo">Information used to map classes to database tables and queries.</param>
 /// <remarks>
 /// If <paramref name="databaseName"/> is <see langword="null" /> or
 /// <see cref="string.Empty"/> a database with a name
 /// derived from the other parameters supplied will be created. See
 /// <see cref="NHibernateInitializer.DeriveDatabaseNameFrom(Assembly)"/> and <see cref="NHibernateInitializer.DeriveDatabaseNameFrom(DatabaseEngine, Assembly)"/>
 /// </remarks>
 public static void InitializeNHibernateAndIoC(PersistenceFramework framework,
                                               string rhinoContainerConfig,
                                               DatabaseEngine databaseEngine,
                                               string databaseName,
                                               MappingInfo mappingInfo)
 {
     NHibernateInitializer.Initialize(framework, mappingInfo).Using(databaseEngine, databaseName).AndIoC(
         rhinoContainerConfig);
 }
Пример #8
0
 /// <summary>
 /// NHibernate 용 Domain을 테스트하기 위해, 환경을 초기화합니다.
 /// </summary>
 /// <param name="containerConfigPath">Castle Windsor configuration file path</param>
 /// <param name="databaseEngine">Database 종류</param>
 /// <param name="databaseName">Database name</param>
 /// <param name="mappingInfo">Domain Model의 Mapping information</param>
 /// <param name="configAction">configuration 부가 작업</param>
 public static void InitializeNHibernateAndIoC(string containerConfigPath,
                                               DatabaseEngine databaseEngine,
                                               string databaseName,
                                               MappingInfo mappingInfo,
                                               Action<NHibernate.Cfg.Configuration> configAction) {
     NHibernateInitializer.Initialize(mappingInfo, configAction)
         .Using(databaseEngine, databaseName)
         .AndIoC(containerConfigPath);
 }
Пример #9
0
 public MappingStrategy(MappingInfo mappingInfo)
 {
     Source = mappingInfo.MappingSourceType;
     Target = mappingInfo.MappingTargetType;
     HasTargetInstance = mappingInfo.MapIntoExistingTargetInstance;
     ContextExpression = Expression.Parameter(typeof (MappingContext), "context");
     SourceExpression = Expression.Variable(Source, "source");
     TargetExpression = Expression.Variable(Target, "target");
     MapperExpression = Expression.Property(ContextExpression, MappingContextMeta.Mapper);
 }
Пример #10
0
 public override StringBuilder BuildInsertColumns(MappingInfo.IObjectMapInfo map, object entity)
 {
     StringBuilder b = new StringBuilder();
     foreach (var pmi in map.PropertyMaps)
     {
         b.Append(_tr.GetEscapedColumnName(pmi.ColumnName)).Append(_tr.ColumnDelimiter);
     }
     b.RemoveEnd(_tr.ColumnDelimiter);
     return b;
 }
Пример #11
0
 /// <summary>
 /// NHibernate 용 Domain을 테스트하기 위해, 환경을 초기화합니다.
 /// </summary>
 /// <param name="containerConfigPath">Castle Windsor configuration file path</param>
 /// <param name="databaseEngine">Database 종류</param>
 /// <param name="databaseName">Database name</param>
 /// <param name="mappingInfo">Domain Model의 Mapping information</param>
 /// <param name="properties">NHibernate configuration 정보</param>
 public static void InitializeNHibernateAndIoC(string containerConfigPath,
                                               DatabaseEngine databaseEngine,
                                               string databaseName,
                                               MappingInfo mappingInfo,
                                               IDictionary<string, string> properties) {
     NHibernateInitializer.Initialize(mappingInfo, null)
         .Using(databaseEngine, databaseName)
         .ConfiguredBy(properties)
         .AndIoC(containerConfigPath);
 }
Пример #12
0
        public void MappingInfos_SimpleIndex()
        {
            var m = new MappingInfo(typeof(Tag));

            m.Should().NotBeNull();

            m.CollectionName.Should().Be("Tag");
            m.DatabaseName.Should().Be("DefaultDatabase");
            m.EntityType.Should().BeSameAs(typeof(Tag));
            m.IdProperty.Should().Be("Id");
            m.Indexes.Should().HaveCount(1);
            m.Indexes.First().Properties.First().Should().Be("Value");
            m.Indexes.First().Unique.Should().BeTrue();
        }
Пример #13
0
        private void WriteValueGet(ILGenerator ilOut, MappingInfo info, MethodInfo getValueMethod)
        {
#if EFCore
            if (info.ValueConverter != null)
            {
                convertersListField = convertersListField ??
                                      typeBuilder.DefineField("Converters", typeof(Func <object, object>[]),
                                                              FieldAttributes.Public | FieldAttributes.Static);

                int convIndex = converters.IndexOf(info.ValueConverter);
                if (convIndex < 0)
                {
                    converters.Add(info.ValueConverter);
                    convIndex = converters.Count - 1;
                }

                ilOut.Emit(OpCodes.Ldsfld, convertersListField);
                ilOut.Emit(OpCodes.Ldc_I4_S, convIndex);
                ilOut.Emit(OpCodes.Ldelem_Ref);

                ilOut.Emit(OpCodes.Ldarg_0);
                ilOut.Emit(getValueMethod.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, getValueMethod);

                ilOut.Emit(OpCodes.Callvirt, typeof(Func <object, object>).GetMethod("Invoke"));

                if (info.ValueConverter.ProviderClrType.IsValueType)
                {
                    ilOut.Emit(OpCodes.Unbox_Any, info.ValueConverter.ProviderClrType);
                }
                else
                {
                    ilOut.Emit(OpCodes.Castclass, info.ValueConverter.ProviderClrType);
                }

                return;
            }
            else if (getValueMethod == null)
            {
                ilOut.Emit(OpCodes.Ldarg_0);
                ilOut.Emit(OpCodes.Ldstr, info.QualifiedColumnName);
                ilOut.Emit(OpCodes.Ldarg_2);
                ilOut.Emit(OpCodes.Call, typeof(ValueHelper <T>).GetMethod(nameof(ValueHelper <T> .Get))
                           .MakeGenericMethod(info.DbProperty.ClrType));

                return;
            }
#endif
            ilOut.Emit(OpCodes.Ldarg_0);
            ilOut.Emit(getValueMethod.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, getValueMethod);
        }
Пример #14
0
        public bool Delete(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            string sql = MappingInfo.GetSqlStatementByType(obj.GetType(), "Delete");

            return(Dao.Execute(
                       sql,
                       obj
                       ) == 1);
        }
Пример #15
0
        public bool Update(Object obj, string extTableName = null)
        {
            if (obj == null)
            {
                return(false);
            }

            string sql = MappingInfo.GetSqlStatementByType(obj.GetType(), "Update", extTableName);

            return(Dao.Execute(
                       sql,
                       obj
                       ) == 1);
        }
Пример #16
0
        public IEnumerable <Pair <long, Action> > MapTrack(ProgramTrack track, MappingInfo info)
        {
            foreach (var pair in track.EventPairs)
            {
//                runningInfo.ApplyEvent(pair.First, pair.Second);
                var @event = pair.Second;
                switch (@event)
                {
                case NoteOnEvent onEvent:
                {
                    var microsTime = info.GetMicros(pair.First);
                    var noteNumber = onEvent.NoteNumber;

                    void OnAction()
                    {
                        if (_onCount[noteNumber]++ != 0)
                        {
                            return;
                        }
                        var glowingObject = _glowingArray.GetGlowingForNote(noteNumber)?.Glowing;

                        if (glowingObject != null)
                        {
                            glowingObject.IsGlowing = true;
                        }
                    }

                    void OffAction()
                    {
                        if (--_onCount[noteNumber] != 0)
                        {
                            return;
                        }
                        var glowingObject = _glowingArray.GetGlowingForNote(noteNumber)?.Glowing;

                        if (glowingObject != null)
                        {
                            glowingObject.IsGlowing = false;
                        }
                    }

                    yield return(new Pair <long, Action>(microsTime, OnAction));

                    yield return(new Pair <long, Action>(microsTime + _pulseMicros, OffAction));

                    break;
                }
                }
            }
        }
Пример #17
0
 private IEnumerable <Pair <long, LaunchInfo> > AirMapper(ProgramTrack track, MappingInfo info)
 {
     foreach (var pair in track.EventPairs)
     {
         if (pair.Second is NoteOnEvent noe)
         {
             yield return(new Pair <long, LaunchInfo>(
                              info.GetMicros(pair.First),
                              new LaunchInfo(
                                  _airLauncher.GetGlobalTranslation() + Vector3.Right * (0.2f * noe.NoteNumber),
                                  Vector3.Back * 2 + Vector3.Down)));
         }
     }
 }
Пример #18
0
    void Start()
    {
        MappingInfo mapping = new MappingInfo("Car");

        mapping.AddMapping("Horizontal : 1", "_d");  //RightArrow
        mapping.AddMapping("Horizontal : -1", "_a"); //LeftArrow
        mapping.AddMapping("Horizontal : 0", "!d, !a");
        mapping.AddMapping("Vertical : 1", "_w");    //UpArrow
        mapping.AddMapping("Vertical : -1", "_s");   //DownArrow
        mapping.AddMapping("Vertical : 0", "!w, !s");
        mapping.AddMapping("Break : 1", "_n");
        mapping.AddMapping("Break : 0", "!n");
        mapping.Enroll("PlayerCar");
    }
        private RouteSegment CreateRouteSegment(dynamic routeSegment)
        {
            var mappedRouteSegment = new RouteSegment
            {
                Mrid            = new Guid(routeSegment.mrid.ToString()),
                Coord           = (JObject)routeSegment.coord is null ? null : Convert.FromBase64String(routeSegment.coord.wkb.ToString()),
                Username        = routeSegment.user_name.ToString(),
                WorkTaskMrid    = routeSegment.work_task_mrid.ToString() == string.Empty ? System.Guid.Empty : new Guid(routeSegment.work_task_mrid.ToString()),
                ApplicationName = routeSegment.application_name.ToString(),
                MarkAsDeleted   = (bool)routeSegment.marked_to_be_deleted,
                ApplicationInfo = routeSegment.application_info.ToString(),
                DeleteMe        = (bool)routeSegment.delete_me,

                LifeCycleInfo = new LifecycleInfo(
                    _infoMapper.MapDeploymentState((string)routeSegment.lifecycle_deployment_state),
                    (DateTime?)routeSegment.lifecycle_installation_date,
                    (DateTime?)routeSegment.lifecycle_removal_date
                    ),
                MappingInfo = new MappingInfo(
                    _infoMapper.MapMappingMethod((string)routeSegment.mapping_method),
                    (string)routeSegment.mapping_vertical_accuracy,
                    (string)routeSegment.mapping_horizontal_accuracy,
                    (DateTime?)routeSegment.mapping_survey_date,
                    (string)routeSegment.mapping_source_info
                    ),
                NamingInfo = new NamingInfo(
                    (string)routeSegment.naming_name,
                    (string)routeSegment.naming_description
                    ),
                SafetyInfo = new SafetyInfo(
                    (string)routeSegment.safety_classification,
                    (string)routeSegment.safety_remark
                    ),
                RouteSegmentInfo = new RouteSegmentInfo(
                    _infoMapper.MapRouteSegmentKind((string)routeSegment.routesegment_kind),
                    (string)routeSegment.routesegment_width,
                    (string)routeSegment.routesegment_height
                    )
            };

            // Make fully empty objects into nulls.
            mappedRouteSegment.LifeCycleInfo    = AreAnyPropertiesNotNull <LifecycleInfo>(mappedRouteSegment.LifeCycleInfo) ? mappedRouteSegment.LifeCycleInfo : null;
            mappedRouteSegment.MappingInfo      = AreAnyPropertiesNotNull <MappingInfo>(mappedRouteSegment.MappingInfo) ? mappedRouteSegment.MappingInfo : null;
            mappedRouteSegment.NamingInfo       = AreAnyPropertiesNotNull <NamingInfo>(mappedRouteSegment.NamingInfo) ? mappedRouteSegment.NamingInfo : null;
            mappedRouteSegment.RouteSegmentInfo = AreAnyPropertiesNotNull <RouteSegmentInfo>(mappedRouteSegment.RouteSegmentInfo) ? mappedRouteSegment.RouteSegmentInfo : null;
            mappedRouteSegment.SafetyInfo       = AreAnyPropertiesNotNull <SafetyInfo>(mappedRouteSegment.SafetyInfo) ? mappedRouteSegment.SafetyInfo : null;

            return(mappedRouteSegment);
        }
Пример #20
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <example>
        /// INSERT INTO Configure(UserName,Password) VALUES(@UserName,@Password)
        /// INSERT INTO Configure(UserName,Password) VALUES(:UserName,:Password)
        ///
        /// MSSQL: SELECT @ID = IDENT_CURRENT('Table')
        /// ORACLE: SELECT Sequence.Nextval FROM Sequence
        /// </example>
        public virtual void Insert <T>(T entity)
        {
            MappingInfo <T> mappingInfo = new MappingInfo <T>();
            IDbCommand      command     = this.driver.CreateDbCommand();

            StringBuilder sql           = new StringBuilder();
            string        fullTableName = this.driver.ToFullTableName(mappingInfo.DbName, mappingInfo.TableName);

            sql.AppendFormat("INSERT INTO {0} ", fullTableName);

            StringBuilder columnsExpression = new StringBuilder();
            StringBuilder valuesExpression  = new StringBuilder();
            bool          isFirst           = true;

            foreach (string propertyName in mappingInfo.Columns.Keys)
            {
                ColumnAttribute columnAttribute = mappingInfo.Columns[propertyName];

                // 不处理自增字段
                if (columnAttribute == null || columnAttribute.IsIncrement)
                {
                    continue;
                }

                IDataParameter parameter = this.driver.CreateDbParameter(propertyName);
                command.Parameters.Add(parameter);

                columnsExpression.Append(isFirst ? string.Empty : ",")
                .Append(columnAttribute.Name);

                string sqlParameterName = this.driver.ToSQLParameterName(propertyName);
                valuesExpression.Append(isFirst ? string.Empty : ",")
                .Append(sqlParameterName);

                if (isFirst)
                {
                    isFirst = false;
                }
            }

            sql.AppendFormat("({0})", columnsExpression.ToString())
            .AppendFormat(" VALUES({0})", valuesExpression.ToString());

            command.CommandText = sql.ToString();
            command.CommandType = CommandType.Text;

            SqlUtil.AssignParameters(command.Parameters, entity);
            this.ExecuteNonQuery(command);
        }
Пример #21
0
        static void BuildMap <TFrom, TTo>(ILGenerator il, MappingInfo <TFrom, TTo> mappingInfo, int firstArgIndex, Action emitBeforeMapLoadDelegate, Action emitAfterMapLoadDelegate, Dictionary <MetaMemberPair <TFrom, TTo>, FieldBuilder> convertActionDictionary)
        {
            var fromType = typeof(TFrom);
            var toType   = typeof(TTo);

            var argFrom     = new ArgumentField(il, firstArgIndex, fromType);
            var argResolver = new ArgumentField(il, firstArgIndex + 1);

            // call beforeMap
            if (mappingInfo.BeforeMap != null)
            {
                emitBeforeMapLoadDelegate();
                argFrom.EmitLdarg();
                il.EmitCall(EmitInfo.GetActionInvoke <TFrom>());
            }

            // if(from == null) return null
            if (!fromType.IsValueType)
            {
                var gotoNextLabel = il.DefineLabel();
                argFrom.EmitLoad();
                il.Emit(OpCodes.Brtrue_S, gotoNextLabel);
                il.Emit(OpCodes.Ldnull);
                il.Emit(OpCodes.Ret);
                il.MarkLabel(gotoNextLabel);
            }

            // construct totype
            var result = EmitNewObject <TFrom, TTo>(il, argFrom, mappingInfo.TargetConstructor);

            // map from -> to.

            foreach (var item in mappingInfo.TargetMembers)
            {
                EmitMapMember(il, item, argFrom, argResolver, result, convertActionDictionary);
            }

            // call afterMap
            if (mappingInfo.AfterMap != null)
            {
                emitAfterMapLoadDelegate();
                il.EmitLdloc(result);
                il.EmitCall(EmitInfo.GetActionInvoke <TTo>());
            }

            // end.
            il.EmitLdloc(result);
            il.Emit(OpCodes.Ret);
        }
Пример #22
0
        private ActionResult GetHomeView()
        {
            Dictionary <string, string> pages = new Dictionary <string, string>();
            string rootPath = Server.MapPath("~/");

            Configuration configuration = Service.GetConfiguration(rootPath, "TridionRazorMapping.xml");

            if (configuration == null)
            {
                return(View("~/Views/Shared/MappingError.cshtml"));
            }

            MappingInfo mapping = configuration.FirstOrDefault(x => x.Name == (configuration.DefaultConfiguration ?? "Default"));

            if (mapping == null)
            {
                return(View("~/Views/Shared/MappingError.cshtml"));
            }

            List <ProjectFileInfo> layouts          = new List <ProjectFileInfo>();
            ProjectFolderInfo      componentLayouts = mapping.ProjectFolders.FirstOrDefault(x => x.ProjectFolderRole == ProjectFolderRole.ComponentLayout);

            if (componentLayouts != null && componentLayouts.ChildItems != null)
            {
                layouts.AddRange(componentLayouts.ChildItems.Where(x => x is ProjectFileInfo).Cast <ProjectFileInfo>());
            }
            ProjectFolderInfo pageLayouts = mapping.ProjectFolders.FirstOrDefault(x => x.ProjectFolderRole == ProjectFolderRole.PageLayout);

            if (pageLayouts != null && pageLayouts.ChildItems != null)
            {
                layouts.AddRange(pageLayouts.ChildItems.Where(x => x is ProjectFileInfo).Cast <ProjectFileInfo>());
            }

            foreach (ProjectFileInfo fileInfo in layouts)
            {
                if (string.IsNullOrEmpty(fileInfo.TestItemTcmId) || string.IsNullOrEmpty(fileInfo.TestTemplateTcmId))
                {
                    pages.Add(fileInfo.Path.Replace("\\", "/"), "");
                }
                else
                {
                    pages.Add(fileInfo.Path.Replace("\\", "/"), "/" + System.IO.Path.GetFileNameWithoutExtension(fileInfo.Name) + "/" + fileInfo.TestItemTcmId.Replace("tcm:", "") + "/" + fileInfo.TestTemplateTcmId.Replace("tcm:", ""));
                }
            }

            ViewBag.Pages = pages;

            return(View("~/Views/Shared/Home.cshtml"));
        }
 public static UnitOfWorkTestContext For(PersistenceFramework framwork,
                                         string rhinoContainerConfig,
                                         UnitOfWorkTestContextDbStrategy dbStrategy,
                                         MappingInfo mappingInfo)
 {
     switch (framwork)
     {
         case PersistenceFramework.ActiveRecord:
             return CreateActiveRecordImplementation(dbStrategy, mappingInfo, rhinoContainerConfig);
         case PersistenceFramework.NHibernate:
             return new NHibernateUnitOfWorkTestContext(dbStrategy, rhinoContainerConfig, mappingInfo);
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Пример #24
0
        public override void Insert <T>(T entity)
        {
            base.Insert <T>(entity);

            // 获取自增值并赋给 PrimaryKeyProperty
            MappingInfo <T> tableInfo = new MappingInfo <T>();

            if (!string.IsNullOrEmpty(tableInfo.IncrementName))
            {
                string sql         = string.Format("SELECT IDENT_CURRENT('{0}')", tableInfo.TableName);
                object returnValue = this.ExecuteScalar(sql, CommandType.Text);

                SqlUtil.SetValue(entity, tableInfo.IncrementName, returnValue);
            }
        }
Пример #25
0
    private void Start()
    {
        panel = transform.GetChild(0).gameObject;
        panel.SetActive(isActive);
        processingPanel = transform.GetChild(1).gameObject;
        for (int i = 0; i < processingPanel.transform.GetChild(1).childCount; i++)
        {
            processingQuestListTextList.Add(processingPanel.transform.GetChild(1).GetChild(i).GetChild(0).GetComponent <Text>());
        }
        processingQuestNameList = new List <string>();
        MappingInfo mapping = new MappingInfo("QuestUI");

        mapping.AddMapping("CloseUI : ", "esc");
        mapping.Enroll("QuestUI");
    }
Пример #26
0
        public static async Task <object[]> ParseParams <T>(MappingInfo <T> mappingInfo, HttpListenerContext context) where T : IAbstractMapping
        {
            string path = context.Request.Url.AbsolutePath;

            return(await Task.Run(async() =>
            {
                object[] methodParams = new object[mappingInfo.Method.GetParameters().Length];
                var pathParamMatches = mappingInfo.Mapping.PathRegex.Match(path);
                if (pathParamMatches.Groups.Count > 1)
                {
                    for (int i = 1; i < pathParamMatches.Groups.Count; i++)
                    {
                        int pathParamIndex = i - 1;
                        var m = pathParamMatches.Groups[i];
                        foreach (var paramInfo in mappingInfo.RequiredParams.Values)
                        {
                            if (paramInfo.ParamPathIndex == pathParamIndex)
                            {
                                var converted = Convert.ChangeType(m.Value, paramInfo.ParamType);
                                methodParams[paramInfo.ParamMethodIndex] = converted;
                            }
                        }
                    }
                }
                if (mappingInfo.RequiredRequestBody != null)
                {
                    object result;
                    using (var reader = new StreamReader(context.Request.InputStream, context.Request.ContentEncoding))
                    {
                        var resultString = await reader.ReadToEndAsync();
                        var settings = new JsonSerializerSettings();
                        settings.NullValueHandling = NullValueHandling.Ignore;
                        settings.Formatting = Formatting.None;
                        settings.MaxDepth = 15;
                        result = JsonConvert.DeserializeObject(resultString, mappingInfo.RequiredRequestBody.Value.ParamType, settings);
                    }
                    methodParams[mappingInfo.RequiredRequestBody.Value.ParamMethodIndex] = result;
                }
                var injectionParams = InjectedAttribute.FindParameters(mappingInfo.Method, context);

                foreach (var injection in injectionParams)
                {
                    methodParams[injection.ParameterPosition] = injection.ParameterObject;
                }

                return methodParams;
            }));
        }
Пример #27
0
        /// <summary>
        /// Writes a log entry.
        /// </summary>
        /// <param name="message">A string that contains the message to be logged.</param>
        /// <param name="level">A <see cref="LogLevel"/> enumeration value that specifies the event type.</param>
        /// <param name="eventId">An integer identifying the event that occurred.</param>
        /// <param name="exception">Exception to log</param>
        /// <param name="callerData">Caller data information.</param>
        public void WriteExceptionEntry(string message, LogLevel level, int eventId, Exception exception, CallerData callerData = null)
        {
            if (level > Level)
            {
                return;
            }

            ColoredConsoleEventArgs e = new ColoredConsoleEventArgs
            {
                Layout  = Layout,
                Message = message
            };

            ColoredConsoleLogEntry?.Invoke(this, e);

            if (e.Handled)
            {
                return;
            }

            // Gets mapping
            ColoredConsoleMapping mapping = Layout.GetMapping(level) ?? ColoredConsoleMapping.DefaultInfoMapping;

            // Gets entries to log
            List <string> entries = mapping.Pattern.ToList();

            // Log Message value
            string      messageEntry   = entries.FirstOrDefault();
            MappingInfo messageMapping = new MappingInfo {
                Message = message, Caller = callerData, Level = level
            };

            Console.ForegroundColor = ColoredConsoleMapping.DefaultInfoMapping.ForeColor;
            Console.BackgroundColor = ColoredConsoleMapping.DefaultInfoMapping.BackColor;
            Console.Write(messageMapping.Parse(messageEntry));

            // Log Exeption
            entries.Remove(messageEntry);
            Console.ForegroundColor = mapping.ForeColor;
            Console.BackgroundColor = mapping.BackColor;
            foreach (string entry in entries)
            {
                MappingInfo info = new MappingInfo {
                    Message = exception.Message, Exception = exception, Caller = callerData, Level = level
                };
                Console.Write(info.Parse(entry));
            }
        }
Пример #28
0
        ///获取xml中配置的 User.Select语句, 或者根据对象的属性映射生成语句
        private string GetMappedOrDefaultSql(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("MappingType", "QueryInfo未指定查询的对象类型!");
            }

            string key = type.Name + ".Select";
            string sql = StatementParser.GetMappedStaticSql(key);

            if (sql.Equals(key))
            {
                sql = (MappingInfo.GetMappingInfo(type).Select + "t");
            }
            return(sql);
        }
Пример #29
0
    // Start is called before the first frame update
    void Start()
    {
        playerUI     = transform.GetChild(6).gameObject;
        menuBase     = new MenuBase(this, transform.GetChild(2).gameObject);
        confirmSave  = new ConfirmSave(this, transform.GetChild(4).gameObject);
        confirmClose = new ConfirmClose(this, transform.GetChild(3).gameObject);
        optionMenu   = new OptionMenu(this, transform.GetChild(5).gameObject);
        menuBase.lootPanel.SetActive(false);
        confirmSave.lootPanel.SetActive(false);
        confirmClose.lootPanel.SetActive(false);
        optionMenu.lootPanel.SetActive(false);
        // 레이어용.
        MappingInfo mapping = new MappingInfo("MenuUI");

        mapping.Enroll("MenuUI");
    }
Пример #30
0
        /// <summary>
        /// We obtain the server path starting with /. This corresponds to the checkout directory
        /// So we remove the relative url of the checkout directory from the server path and replace it with the svn checkout directory path
        /// </summary>
        private string MapToLocalFile_ServerIsAbsolute(string serverPath)
        {
            if (_mappingInfo == null)
            {
                _mappingInfo = GetMappingInfo(BaseDirectory);
            }

            var serverNormalized = serverPath.Replace("/", "\\").TrimEnd('\\');

            var common = serverNormalized.Substring(_mappingInfo.RelativeUrlToCheckoutDirectory.Length).Trim('\\');

            // Note: second part must not start with \\
            var localPath = Path.Combine(_mappingInfo.AbsolutePathToCheckoutDirectory, common);

            return(localPath);
        }
Пример #31
0
    void Start()
    {
        // 효과 없는 불필요한 코드
        // Message msg4 = new Message("InventoryManager/modifyItem: Health, 0 ");
        // Message msg5 = new Message("InventoryManager/modifyItem: Fish, 0 ");
        // Message msg6 = new Message("InventoryManager/modifyItem: Bug, 0 ");

        // msg4.functionCall();
        // msg5.functionCall();
        // msg6.functionCall();

        MappingInfo map1 = new MappingInfo("Zone");

        map1.AddMapping("Tem :", "o");
        map1.Enroll();
    }
Пример #32
0
        public async Task ParseAsync_ReturnsCorrectResults()
        {
            // Arrange
            var dataWithoutHeader = new List <string[]>
            {
                new[] { "Mark", "23" },
                new[] { "Thomas", "27" },
            };

            var testEntityMeta = _provider.GetMetadata(1, typeof(TestEntity), null, null);
            var nameMeta       = testEntityMeta.Property(nameof(TestEntity.Name));
            var ageMeta        = testEntityMeta.Property(nameof(TestEntity.Age));

            var nameMapping = new PropertyMappingInfo(nameMeta, nameMeta)
            {
                Index = 0
            };
            var ageMapping = new PropertyMappingInfo(ageMeta, ageMeta)
            {
                Index = 1
            };

            var simpleProps = new List <PropertyMappingInfo> {
                nameMapping, ageMapping
            };
            var collectionProps = new List <MappingInfo> {
            };
            var mapping         = new MappingInfo(testEntityMeta, testEntityMeta, simpleProps, collectionProps, null, null);
            var errors          = new ImportErrors();

            // Act
            var entities = await _parser.ParseAsync <TestEntity>(dataWithoutHeader, mapping, errors);

            // Assert
            Assert.Collection(entities,
                              entity =>
            {
                Assert.Equal("Mark", entity.Name);
                Assert.Equal(23, entity.Age);
            },
                              entity =>
            {
                Assert.Equal("Thomas", entity.Name);
                Assert.Equal(27, entity.Age);
            }
                              );
        }
Пример #33
0
        public T Map <T>(bool fullmap = false) where T : class
        {
            T           value = null;
            MappingInfo map;

            if (_mappinGS != null && _mappinGS.TryGetValue(typeof(T), out map))
            {
                value = map.Supported ? (T)map.Value : null;
            }
            else
            {
                try
                {
                    Mapper mapper = new Mapper {
                        program = this
                    };
                    value = (T)mapper.CreateMapType(typeof(T), fullmap);
                    if (value != null)
                    {
                        map = new MappingInfo {
                            Value = value, Supported = true
                        }
                    }
                    ;
                    else
                    {
                        map = new MappingInfo {
                            Supported = false
                        }
                    };
                }
                catch (InvalidMappingException)
                {
                    map = new MappingInfo {
                        Supported = false
                    };
                }

                if (_mappinGS == null)
                {
                    _mappinGS = new Dictionary <Type, MappingInfo>(1);
                }
                _mappinGS.Add(typeof(T), map);
            }

            return(value);
        }
Пример #34
0
 internal Database(NotesAccessor accessor, Domino.NotesDatabase notesDb)
 {
     if (!notesDb.IsOpen)
     {
         notesDb.Open();
     }
     this._accessor   = accessor;
     this._notesDb    = notesDb;
     this._title      = notesDb.Title;
     this._server     = notesDb.Server;
     this._sourceType = (NotesDbType)(int)notesDb.type;
     this._targetType = MappingInfo.GetTagetDbType(this._sourceType);
     this._fileName   = notesDb.FileName;
     this._notesUrl   = notesDb.NotesURL;
     this._replicaId  = notesDb.ReplicaID;
     this._sourcePath = notesDb.FilePath;
 }
Пример #35
0
        /// 为了节省时间, 可以调用一次 GetOrdinal, 然后将结果分配给整数变量以便在循环中使用。
        private Dictionary <int, string> Match(IDataRecord dataRecord)
        {
            Dictionary <int, string> dictionary = new Dictionary <int, string>();
            MappingInfo mappingInfo             = new MappingInfo(this.type);

            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                string columnName = dataRecord.GetName(i);

                if (mappingInfo.ContainsColumn(columnName))
                {
                    dictionary.Add(i, mappingInfo.GetPropertyName(columnName));
                }
            }

            return(dictionary);
        }
Пример #36
0
        private string DisplayParams(MappingInfo map)
        {
            if (map.MappingParameters.Count < 1)
            {
                return("");
            }
            var sb = new StringBuilder(" (");

            foreach (var kvp in map.MappingParameters)
            {
                sb.Append(kvp.Key);
                sb.Append("=");
                sb.Append(kvp.Value);
            }
            sb.Append(") ");
            return(sb.ToString());
        }
Пример #37
0
        public void MappingInfos_ComplexIndex()
        {
            var m = new MappingInfo(typeof(Comment));

            m.Should().NotBeNull();

            m.CollectionName.Should().Be("Comment");
            m.DatabaseName.Should().Be("DefaultDatabase");
            m.EntityType.Should().BeSameAs(typeof(Comment));
            m.IdProperty.Should().Be("Id");
            m.Indexes.Should().HaveCount(1);
            m.Indexes.First().Properties.Should().HaveCount(3);
            m.Indexes.First().Properties.Any(p => p == "Value").Should().BeTrue();
            m.Indexes.First().Properties.Any(p => p == "Owner").Should().BeTrue();
            m.Indexes.First().Properties.Any(p => p == "Post").Should().BeTrue();
            m.Indexes.First().Unique.Should().BeFalse();
        }
Пример #38
0
        public override StringBuilder BuildInsertValues(MappingInfo.IObjectMapInfo map, object entity)
        {
            StringBuilder b = new StringBuilder();
            IReflector r = Reflector.Bind(entity);
            foreach (var pmi in map.PropertyMaps)
            {
                if (map.PrimaryKeyGenerate == PrimaryKeyGenerate.Customized && map.PrimaryKeyMaps.Contains(pmi))
                {
                    string sequenceName = map.PKGenerateString.RemoveBegin(ConstantString.SEQ_Prefix);
                    b.Append(sequenceName).Append(_tr.MemberAccess).Append(ConstantString.SEQ_NextVal).Append(_tr.ColumnDelimiter);
                    continue;
                }

                b.Append(_tr.GetValueString(r.GetPropertyValue(pmi.PropertyName))).Append(_tr.ColumnDelimiter);
            }
            b.RemoveEnd(_tr.ColumnDelimiter);
            return b;
        }
        public IEnumerable <Pair <long, Action> > MapTrack(ProgramTrack track, MappingInfo info)
        {
            foreach (var pair in track.EventPairs)
            {
                switch (pair.Second)
                {
                case NoteOnEvent noe:
                    yield return(new Pair <long, Action>(info.GetMicros(pair.First), () => _movingObject.AddObject(noe)));

                    break;

                case NoteOffEvent noe:
                    yield return(new Pair <long, Action>(info.GetMicros(pair.First), () => _movingObject.RemoveObject(noe)));

                    break;
                }
            }
        }
        public void CanSwitchBetweenPersistentFrameworksWithinSameTest()
        {
            MappingInfo mappingInfo = MappingInfo.FromAssemblyContaining <AREntity>();

            InitializeNHibernateAndIoC(PersistenceFramework.NHibernate,
                                       NHibernateWindsorFilePath,
                                       DatabaseEngine.SQLite,
                                       "",
                                       mappingInfo);
            VerifyCanCreateUseAndDisposeUnitOfWork();

            InitializeNHibernateAndIoC(PersistenceFramework.ActiveRecord,
                                       ActiveRecordWindsorFilePath,
                                       DatabaseEngine.SQLite,
                                       "",
                                       mappingInfo);
            VerifyCanCreateUseAndDisposeUnitOfWork();
        }
Пример #41
0
        public void PrimaryMapping_Collection_List()
        {
            var adoHelper = new AdoHelper <List <int> >(_connection);
            var queryInfo = adoHelper.Query("Hello");

            Assert.AreEqual(_connection, queryInfo.Connection);
            Assert.AreEqual(QueryInfo <List <int> > .ModelEntityType.Collection, queryInfo.ModelType);
            Assert.AreEqual("Hello", queryInfo.Command.CommandText);

            Assert.AreEqual(1, queryInfo.ModelStructureTable.Count);

            MappingInfo mappingInfo = queryInfo.ModelStructureTable[0];

            Assert.IsNotNull(mappingInfo);
            Assert.AreEqual(MappingInfo.FieldType.CollectionItem, mappingInfo.MapFieldType);
            Assert.AreEqual(false, mappingInfo.IsNullable);
            Assert.AreEqual(typeof(int), mappingInfo.FullType);
            Assert.AreEqual(typeof(int), mappingInfo.InnerType);
        }
Пример #42
0
        public void PrimaryMapping_ValueTuple()
        {
            var adoHelper = new AdoHelper <(int, string)>(_connection);
            var queryInfo = adoHelper.Query("Hello");

            Assert.AreEqual(_connection, queryInfo.Connection);
            Assert.AreEqual(QueryInfo <(int, string)> .ModelEntityType.Tuple, queryInfo.ModelType);
            Assert.AreEqual("Hello", queryInfo.Command.CommandText);

            Assert.AreEqual(2, queryInfo.ModelStructureTable.Count);

            MappingInfo mappingInfo = queryInfo.ModelStructureTable[0];

            Assert.IsNotNull(mappingInfo);
            Assert.AreEqual(MappingInfo.FieldType.Field, mappingInfo.MapFieldType);
            Assert.AreEqual(false, mappingInfo.IsNullable);
            Assert.AreEqual(typeof(int), mappingInfo.FullType);
            Assert.AreEqual(typeof(int), mappingInfo.InnerType);
        }
Пример #43
0
        public bool Delete <T>(Object id)
        {
            if (id == null)
            {
                return(false);
            }

            Type type = typeof(T);

            MappingInfo info = MappingInfo.GetMappingInfo <T>();

            return(Dao.Execute(
                       info.Delete,
                       new Dictionary <string, object>()
            {
                { GetPrimaryKey(type), id }
            }
                       ) == 1);
        }
Пример #44
0
        public MappingStrategy(MappingInfo mappingInfo, IMappingDescriptor descriptor)
        {
            Descriptor = descriptor;
            Source = mappingInfo.MappingSourceType;
            Target = mappingInfo.MappingTargetType;
            HasTargetInstance = mappingInfo.MapIntoExistingTargetInstance;
            try
            {
                TargetConstructor = Target.GetConstructors().Single();
                ConstructorParameterMappingSteps = new OrderedKeyedCollection<ParameterInfo, MappingStep>(TargetConstructor.GetParameters());
            }
            catch (InvalidOperationException)
            {
                throw new ArgumentException("Target type must have single public constructor. This is the only scenario supported at the moment.", "target");
            }

            ContextExpression = Expression.Parameter(typeof (MappingContext), "context");
            SourceExpression = Expression.Variable(Source, "source");
            TargetExpression = Expression.Variable(Target, "target");
            MapperExpression = Expression.Property(ContextExpression, MappingContextMeta.Mapper);
        }
        public MappingStrategy BuildMappingStrategy(MappingInfo mappingInfo)
        {
            var strategy = new MappingStrategy(mappingInfo, descriptor);

            //first try to shortcircuit
            var directMappingStep = new DirectMappingStep(strategy.Source, strategy.Target);
            var converter = ApplyConverter(directMappingStep, withFallback: false);
            if (converter != null)
            {
                directMappingStep.Conversion = converter;
                strategy.InitTargetStep = directMappingStep;
                return strategy;
            }
            foreach (var pattern in mappingPatterns)
            {
                pattern.Contribute(strategy);
            }
            foreach (var mappingStep in strategy.MappingSteps)
            {
                mappingStep.Conversion = ApplyConverter(mappingStep, withFallback: true);
            }
            if (strategy.HasTargetInstance)
            {
                strategy.InitTargetStep = new SimpleStep(strategy.Target, strategy.Target, (s, _) => Expression.Convert(Expression.Property(s.ContextExpression, MappingContextMeta.TargetInstance), s.Target));
            }
            else
            {
                foreach (var mappingStep in strategy.ConstructorParameterMappingSteps.ByKey)
                {
                    if (mappingStep.Value == null)
                    {
                        throw new InvalidOperationException(string.Format("No mapping for constructor parameter {0} has been specified. All constructor parameters need value", mappingStep.Key));
                    }
                    mappingStep.Value.Conversion = ApplyConverter(mappingStep.Value, withFallback: true);
                }
                strategy.InitTargetStep = new SimpleStep(strategy.Target, strategy.Target, (s, _) => Expression.New(s.TargetConstructor, GetConstructorParameters(s)));
            }
            return strategy;
        }
Пример #46
0
        private MappingInfo GetMappingInfo()
        {
            var mappingInfo = new MappingInfo();
            try
            {
                var descriptor = new SparkViewDescriptor()
                    .AddTemplate(_path);

                var entry = _engine.CreateEntryInternal(descriptor, false);

                mappingInfo.GeneratedCode = entry.SourceCode;

                mappingInfo.Mapping = entry.SourceMappings
                    .Where(m => string.Equals(m.Source.Begin.SourceContext.FileName, _path,
                                              StringComparison.InvariantCultureIgnoreCase))
                    .Select(m => new _SOURCEMAPPING
                    {
                        start1 = m.Source.Begin.Offset,
                        end1 = m.Source.End.Offset,
                        start2 = m.OutputBegin,
                        end2 = m.OutputEnd
                    })
                    .ToArray();

                mappingInfo.Count = mappingInfo.Mapping.Length;
            }
            catch (Exception ex)
            {
                mappingInfo.GenerationError = ex;
            }

            if (mappingInfo.Count == 0)
                mappingInfo.Mapping = new _SOURCEMAPPING[1];
            return mappingInfo;
        }
Пример #47
0
 /// <summary>
 /// 생성자
 /// </summary>
 /// <param name="dbStrategy">테스트용 DB 생성 전략</param>
 /// <param name="windsorConfigPath">IoC 환경설정 파일경로</param>
 /// <param name="mappingInfo">NHibernate 매핑 정보</param>
 /// <param name="configAction">Configuration 빌드 시 추가할 사항을 정의한 Action</param>
 public NHUnitOfWorkTestContext(UnitOfWorkTestContextDbStrategy dbStrategy,
                                string windsorConfigPath,
                                MappingInfo mappingInfo,
                                Action<Configuration> configAction)
     : base(dbStrategy, windsorConfigPath, mappingInfo, configAction) {}
 public static NHibernateInitializer Initialize(PersistenceFramework framework, MappingInfo mappingInfo)
 {
     NHibernateInitializer initializer=new NHibernateInitializer(framework,mappingInfo);
     return initializer;
 }
 public static LocalSessionAwareCoreServiceClient GetTcpClient(MappingInfo mapping)
 {
     EnsureCredentialsNotEmpty(mapping);
     return GetTcpClient(mapping.Host, mapping.Username, mapping.Password);
 }
 /// <summary>
 /// See <see cref="IntializeNHibernateAndIoC(PersistenceFramework,string,DatabaseEngine,string,MappingInfo)"/>
 /// </summary>
 public static void IntializeNHibernateAndIoC(PersistenceFramework framework, string rhinoContainerConfig, MappingInfo mappingInfo)
 {
     NHibernateInitializer.Initialize(framework, mappingInfo).AndIoC(rhinoContainerConfig);
 }
 public static bool IsCheckedOut(MappingInfo mapping, string id)
 {
     return FindCheckedOutItems(mapping).Any(x => x.TcmId == id);
 }
 /// <summary>
 /// See <see cref="IntializeNHibernateAndIoC(PersistenceFramework,string,DatabaseEngine,string,MappingInfo)"/>
 /// </summary>
 public static void IntializeNHibernate(PersistenceFramework framework, MappingInfo mappingInfo)
 {
     NHibernateInitializer.Initialize(framework, mappingInfo);
 }
 public static void IntializeNHibernateAndIoC(PersistenceFramework framework,
     string rhinoContainerConfig,
     DatabaseEngine databaseEngine,
     string databaseName,
     MappingInfo mappingInfo,
     IDictionary<string, string> properties)
 {
     NHibernateInitializer.Initialize(framework, mappingInfo)
         .Using(databaseEngine, databaseName)
         .ConfiguredBy(properties)
         .AndIoC(rhinoContainerConfig);
 }
Пример #54
0
        private void SetCrawledPropertyMappings(
            SPSite site,
            SPManagedPropertyInfo managedPropertyDefinition,
            ManagedPropertyInfo managedPropertyInfo,
            SearchServiceApplication ssa,
            SearchObjectOwner owner,
            List<MappingInfo> mappings)
        {
            // Ensure crawl properties mappings
            foreach (var crawledPropertyKeyAndOrder in managedPropertyInfo.CrawledProperties)
            {
                // Get the crawled property (there may be more than one matching that name)
                var matchingCrawledProperties = this.GetCrawledPropertyByName(site, crawledPropertyKeyAndOrder.Key);
                if (matchingCrawledProperties != null && matchingCrawledProperties.Count > 0)
                {
                    foreach (var crawledProperty in matchingCrawledProperties)
                    {
                        // Create mapping information
                        var mapping = new MappingInfo
                        {
                            CrawledPropertyName = crawledProperty.Name,
                            CrawledPropset = crawledProperty.Propset,
                            ManagedPid = managedPropertyDefinition.Pid,
                            MappingOrder = crawledPropertyKeyAndOrder.Value
                        };

                        // If managed property doesn't already contain a mapping for the crawled property, add it
                        if (
                            ssa.GetManagedPropertyMappings(managedPropertyDefinition, owner)
                                .All(m => m.CrawledPropertyName != mapping.CrawledPropertyName))
                        {
                            mappings.Add(mapping);
                        }
                        else
                        {
                            this.logger.Info(
                                "Mapping for managed property {0} and crawled property with name {1} is already exists",
                                managedPropertyDefinition.Name,
                                crawledPropertyKeyAndOrder);
                        }
                    }
                }
                else
                {
                    this.logger.Warn("Crawled property with name {0} not found!", crawledPropertyKeyAndOrder);
                }
            }

            // Apply mappings to the managed property
            if (mappings.Count > 0)
            {
                ssa.SetManagedPropertyMappings(managedPropertyDefinition, mappings, owner);
            }
        }
        public static List<string> GetUsingCurrentItems(MappingInfo mapping, string tcmItem)
        {
            if (!EnsureValidClient(mapping))
                return null;

            return GetUsingCurrentItems(tcmItem);
        }
Пример #56
0
 public IIMappingBag Add(MappingInfo mappingInfo)
 {
     mappings.Add(mappingInfo);
     return this;
 }
 private static UnitOfWorkTestContext CreateActiveRecordImplementation(UnitOfWorkTestContextDbStrategy dbStrategy,
                                                                         MappingInfo mappingInfo,
                                                                         string rhinoContainerConfig)
 {
     if (activeRecordType == null)
         activeRecordType = Type.GetType(activeRecordTestContextType);
     if (activeRecordType == null)
     {
         throw new InvalidOperationException("Could not find Active Record context type. Did you forget to reference 'Rhino.Commons.ActiveRecord'?");
     }
     return
         (UnitOfWorkTestContext)
         Activator.CreateInstance(activeRecordType,
                                  new object[] {dbStrategy, rhinoContainerConfig, mappingInfo});
 }
 protected internal NHibernateInitializer(PersistenceFramework framework, MappingInfo mappingInfo)
 {
     Guard.Against<ArgumentNullException>(mappingInfo == null, "MappingInfo is required.");
     this.framework = framework;
     this.mappingInfo = mappingInfo;
     ioc=new IoCInitializer(this);
 }
 public UnitOfWorkTestContext(UnitOfWorkTestContextDbStrategy dbStrategy,
                              string rhinoContainerConfigPath,
                              MappingInfo assemblies)
 {
     this.rhinoContainerConfigPath = rhinoContainerConfigPath ?? string.Empty;
     this.dbStrategy = dbStrategy;
     mappingInfo = assemblies;
     this.dbStrategy.TestContext = this;
 }
        public static bool IsAnyLocalized(MappingInfo mapping, string id)
        {
            if (!EnsureValidClient(mapping))
                return false;

            return IsAnyLocalized(id);
        }