You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.Core/ThingiProvider/IProvider.cs

74 lines
1.8 KiB

11 years ago

using System;
using System.Collections.Generic;
using FluentValidation.Results;
11 years ago
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.ThingiProvider
{
public interface IProviderRepository<TProvider> : IBasicRepository<TProvider> where TProvider : ModelBase, new()
11 years ago
{
TProvider GetByName(string name);
11 years ago
}
public class ProviderRepository<TProviderDefinition> : BasicRepository<TProviderDefinition>, IProviderRepository<TProviderDefinition>
where TProviderDefinition : ModelBase,
new()
{
protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
public TProviderDefinition GetByName(string name)
{
throw new NotImplementedException();
}
11 years ago
}
public interface IProvider
11 years ago
{
11 years ago
Type ConfigContract { get; }
IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
ProviderDefinition Definition { get; set; }
11 years ago
}
public abstract class ProviderDefinition : ModelBase
11 years ago
{
public string Name { get; set; }
11 years ago
public string Implementation { get; set; }
public bool Enable { get; set; }
11 years ago
public string ConfigContract
{
get
{
if (Settings == null) return null;
return Settings.GetType().Name;
}
set
{
}
}
11 years ago
public IProviderConfig Settings { get; set; }
11 years ago
}
public interface IProviderConfig
11 years ago
{
ValidationResult Validate();
}
11 years ago
public class NullConfig : IProviderConfig
{
11 years ago
public static readonly NullConfig Instance = new NullConfig();
public ValidationResult Validate()
{
return new ValidationResult();
}
11 years ago
}
}