示例#1
0
        public override object Map(DbDataReader dataReader, RowMapperContext context)
        {
            if (context.Instance == null)
            {
                context.Instance = context.PocoData.CreateObject(dataReader);
                if (context.Instance == null)
                {
                    throw new Exception(string.Format("Cannot create POCO '{0}'. It may have no parameterless constructor or be an interface or abstract class without a Mapper factory.", context.Type.FullName));
                }
            }
            else
            {
                this._mappingOntoExistingInstance = true;
            }

            this._mapPlan(dataReader, context.Instance);

            IOnLoaded result = context.Instance as IOnLoaded;

            if (result != null)
            {
                result.OnLoaded();
            }

            return(context.Instance);
        }
示例#2
0
        public override void OnAfterDeserialize(System.Type storageType, object instance)
        {
            IOnLoaded loaded = (IOnLoaded)instance;

            if (loaded != null)
            {
                loaded.OnLoaded();
            }
        }