2013-07-22 6 views
0

에서 공공 매개 변수가없는 생성자가 아닌 추상 형식이어야합니다,이 같은가 레디 스

must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ServiceStack.Redis.RedisClient.Store<T>(T) 


RedisClass.GetInstnace().Store(msg); // Error here 
RedisClass.GetInstnace().Save(); 

타사의 클래스가, 내가 어떻게 개체를 저장하는 것이 을 편집 할 수 있습니다 오류가 아래에있어 ?

답변

0

제 3 자 개체 주위에 래퍼를 만들어 해당 생성자를 호출 한 다음 래퍼를 저장할 수 있습니까?

예.

public class MyWrapper 
{ 
    public ThirdPartyObject ThirdPartyInstance { get; set; } 

    public MyWrapper() 
    { 
     ThirdPartyInstance = new ThirdPartyObject("Constructors"); 
    } 
} 
0

이 오류는 그 IBasicPersistenceProvider.Store <T>() 새로운() 제네릭 제약 조건이 발생합니다. 대신 IBasicPersistenceProvider <T>을 사용하십시오. 저장소() :

RedisClass.GetInstance().As<ThirdPartyClass>().Store(msg);