Exemple #1
0
        /// <summary>
        /// This constructors sets the underlying respository.
        /// </summary>
        /// <param name="respository">The aynsc repository.</param>
        protected ApiPersistenceControllerAsyncBase(IRepositoryAsync <K, E> respository)
        {
            mRespository = respository;
            mSerializers = TransportSerializer.GetSerializers <E>(GetType())
                           .ToDictionary((p) => p.MediaType.ToLowerInvariant());

            //If we have no serializers set on this controller, check the entity.
            if (mSerializers == null || mSerializers.Count == 0)
            {
                mSerializers = TransportSerializer.GetSerializers <E>(typeof(E))
                               .ToDictionary((p) => p.MediaType.ToLowerInvariant());
            }

            mKeyMapper = (KeyMapper <K>)KeyMapper.Resolve <K>();

            mODataValidate = ODataValidationSettingsCreate();
        }
Exemple #2
0
 /// <summary>
 /// This method resolves the mapper that converts the key in to a format suitable for the Uri request.
 /// </summary>
 protected virtual IKeyMapper <K> ResolveKeyMapper()
 {
     return((KeyMapper <K>)KeyMapper.Resolve <K>());
 }
Exemple #3
0
 public static KeyMapper <KT> Add <KT>(KeyMapper <KT> mapper)
 {
     sMaps[typeof(KT)] = mapper;
     return(mapper);
 }