コード例 #1
0
        public void Visit(dynamic current, dynamic relative)
        {
            //* Get this table and that table name
            var currentModel  = ModelBase.Dynamic(current);
            var relativeModel = ModelBase.Dynamic(relative);

            //* set modelname
            CurrentModelName  = currentModel.ModelName;
            RelativeModelName = relativeModel.ModelName;

            //* find intermediate model name
            IntermediateModelName = ModelFacade.GenerateIntermediateModelName(CurrentModelName, RelativeModelName);
            //* Initialize target model
            IntermediateModel = ModelBase.Dynamic(ModelFacade.GenerateIntermediateModel(IntermediateModelName));

            var currModelId     = currentModel.Id;
            var relativeModelId = relativeModel.Id;

            IntermediateModel.Set(currModelId, CurrentModelName + "Id");
            IntermediateModel.Set(relativeModelId, RelativeModelName + "Id");

            var firstCol  = DbFacade.PocoDatas[IntermediateModelName].GetColumnName(CurrentModelName + "Id");
            var secondCol = DbFacade.PocoDatas[IntermediateModelName].GetColumnName(RelativeModelName + "Id");

            IntermediateModel = IntermediateModel.Find(string.Format(" {0}.{1}={3} AND {0}.{2}={4} "
                                                                     , IntermediateModel.TableName
                                                                     , firstCol, secondCol
                                                                     , currModelId
                                                                     , relativeModelId));
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        protected static void DoDynamicModelInitialization(Type model)
        {
            var mdl = ModelBase.Dynamic(model);

            _dynamicModelCache.Add(model.Name, mdl);
        }