2015-01-24 5 views
1

외부 라이브러리를 사용하는 오차드 CMS 모듈이 있습니다. 그리고 나는 그 도서관의 일부 수업을 오차드 기록의 일부로 사용해야합니다. 예를 들어 는 외부 어셈블리 나는 그런외부 어셈블리에서 과수원 CMS 레코드 매핑

public class HistoryRecord {  
    public virtual long Id { get; set; } 
    public virtual DateTime Updated { get; set; } 
    public virtual Operation Operation { get; set; } 
} 
+0

나는 그렇게 할 수 있다고 생각하지 않습니다. 외부 시스템과 상호 작용할 다른 방법을 찾아야합니다. –

답변

0

로, 오차드 IRepository와 함께 사용하고 다른 과수원 CMS 기록의 일부로 사용하는 데이터베이스에 저장해야 클래스를

public class Operation { 
    public virtual long Id { get; set; } 
    public virtual string OperationType { get; set; } 
} 

을 포함 Fluet Configuration을 기반으로 부분 솔루션을 얻을 수있었습니다. 그러나 클래스가 Orchard의 이름 지정 규칙에 해당하는 경우에만 작동합니다. 여기에 있습니다 :

public class SessionConfiguration : ISessionConfigurationEvents { 
    public void Created(FluentConfiguration cfg, AutoPersistenceModel defaultModel) { 
     var ts = new TypeSource(new[] { typeof(OperationRecord) }); 
     cfg.Mappings(m => m.AutoMappings.Add(AutoMap.Source(ts) 
       .Override<OperationRecord>(mapping => mapping.Table("Custom_Module_OperationRecord")) 
      )); 
    } 

    public void Prepared(FluentConfiguration cfg) { } 
    public void Building(Configuration cfg) { } 
    public void Finished(Configuration cfg) { } 
    public void ComputingHash(Hash hash) { } 
} 


public class TypeSource : ITypeSource { 
    private readonly IEnumerable<Type> _types; 
    public TypeSource(IEnumerable<Type> types) { 
     _types = types; 
    } 
    public IEnumerable<Type> GetTypes() { 
     return _types; 
    } 
    public void LogSource(IDiagnosticLogger logger) { 
     throw new NotImplementedException(); 
    } 
    public string GetIdentifier() { 
     throw new NotImplementedException(); 
    } 
}