本文整理汇总了C#中IStorage类的典型用法代码示例。如果您正苦于以下问题:C# IStorage类的具体用法?C# IStorage怎么用?C# IStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStorage类属于命名空间,在下文中一共展示了IStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecordingStorage
public RecordingStorage(IStorage storage)
{
_innerStorage = storage;
Loaded = new HashSet<Uri>();
Saved = new HashSet<Uri>();
}
示例2: CreateSaveOperationForItem
protected override ResourceSaveOperation CreateSaveOperationForItem(IStorage storage, CatalogContext context, CatalogItem item, CancellationToken cancellationToken)
{
// This method decides what to do with the item.
// If it's a RegistrationMakerCatalogItem and it already exists, then don't write content.
var registrationMakerCatalogItem = item as RegistrationMakerCatalogItem;
if (registrationMakerCatalogItem != null)
{
var content = item.CreateContent(Context); // note: always do this first
var resourceUri = item.GetItemAddress();
var saveOperation = new ResourceSaveOperation();
saveOperation.ResourceUri = resourceUri;
if (!registrationMakerCatalogItem.IsExistingItem && content != null)
{
saveOperation.SaveTask = storage.Save(resourceUri, content, cancellationToken);
}
else
{
Trace.WriteLine(string.Format("Resource {0} already exists. Skipping.", resourceUri), "Debug");
}
return saveOperation;
}
return base.CreateSaveOperationForItem(storage, context, item, cancellationToken);
}
示例3: PlayersController
public PlayersController(IStorage<Models.Player> playerStorage, IStorage<Models.BoardGame> boardGamesStorage,
DistanceCalculator distanceCalculator)
{
_playerStorage = playerStorage;
_boardGamesStorage = boardGamesStorage;
_distanceCalculator = distanceCalculator;
}
示例4: Deserialize
public object Deserialize(IStorage storage, Data.Node data, object result)
{
return data is Data.DateTime ? (data as Data.DateTime).Value :
data is Data.Binary ? new System.DateTime(BitConverter.ToInt64((data as Data.Binary).Value, 0)) :
data is Data.String ? System.DateTime.Parse((data as Data.String).Value) :
new System.DateTime();
}
示例5: PObject
internal PObject(IStorage repository, int id, Dictionary<int, IPObject> objectsIndex, bool deferredLoad)
{
if (repository == null)
throw new Exception("Хранилище данных не задано");
Id = id;
_ownerCollection = null;
this.storage = repository;
this.objectsIndex = objectsIndex;
this._deferredLoad = deferredLoad;
// получение значений атрибутов
_attrs = repository.ListAttributes(Id);
if (objectsIndex != null)
objectsIndex.Add(id, this);
// загрузка коллекций
_collections = new Dictionary<string, PCollection>();
List<string> collectsNames = storage.ListCollections(Id);
foreach (string name in collectsNames)
{
string lowName = name.ToLower();
_collections.Add(lowName, new PCollection(this, lowName, deferredLoad));
}
}
示例6: PolymorphicEnumeration
public void PolymorphicEnumeration()
{
var stgs = new IStorage[]
{
new MemoryStorage(),
//new PersistedMemoryStorage(),
new FileSystemStorage("fs"),
//new EsentStorage("esent"),
new SqlSeverStorage("server=.;database=overdb;integrated security=true"),
};
foreach (var stg in stgs)
{
using (var db = new Database(stg, null, new GuidIdFactory()))
{
db.Delete(db.GetEnumerable());
db.SaveMany(new Animal[]
{
new Cat(), new Dog(), new Cow(),
}.AsEnumerable());
var animals = db.GetEnumerable<Animal>();
Assert.That(animals.Count(), Is.EqualTo(3), "{0} not polymorphic", stg.GetType().Name);
}
}
}
示例7: SerfidCore
public SerfidCore(IListener listener, IFilter filter, IStorage storage, IUser user)
{
_listener = listener;
_filter = filter;
_storage = storage;
_user = user;
}
示例8: BarsTimeIntervalEnumerator
public BarsTimeIntervalEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
: base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize)
{
this.endTime = endTime;
this.Reset();
}
示例9: GetCodes
IList<string> GetCodes(IStorage storage, IList<string> codes=null) {
var items= storage.ListItems("");
foreach (var item in items) {
}
return codes;
}
示例10: Deserialize
public object Deserialize(IStorage storage, Data.Node data, object result)
{
return data is Data.Byte ? (data as Data.Byte).Value :
data is Data.Binary ? (data as Data.Binary).Value[0] :
data is Data.String ? byte.Parse((data as Data.String).Value, System.Globalization.CultureInfo.InvariantCulture.NumberFormat) :
(byte)0;
}
示例11: AddStorage
public static async Task AddStorage(this MockServerHttpClientHandler handler, IStorage storage)
{
var files = await storage.List(CancellationToken.None);
foreach (var file in files)
{
var storageFileUrl = file;
var relativeFileUrl = "/" + storageFileUrl.ToString().Replace(storage.BaseAddress.ToString(), string.Empty);
handler.SetAction(relativeFileUrl, async message =>
{
var content = await storage.Load(storageFileUrl, CancellationToken.None);
var response = new HttpResponseMessage(HttpStatusCode.OK);
if (!string.IsNullOrEmpty(content.CacheControl))
{
response.Headers.CacheControl = CacheControlHeaderValue.Parse(content.CacheControl);
}
response.Content = new StreamContent(content.GetContentStream());
if (!string.IsNullOrEmpty(content.ContentType))
{
response.Content.Headers.ContentType = new MediaTypeHeaderValue(content.ContentType);
}
return response;
});
}
}
示例12: StorageRoot
/***********************************************************************/
private StorageRoot(IStorage root, bool readOnly )
: base( root )
{
rootIStorage = root;
containerIsReadOnly = readOnly;
dataSpaceManagerInitializationInProgress = false;
}
示例13: Computer
public Computer(ICpu cpu, IRam ram, IVideoCard gpu, IStorage storage)
{
Storage = storage;
Gpu = gpu;
Ram = ram;
Cpu = cpu;
}
示例14: CreateUser
public Regulus.Project.Crystal.Game.Core CreateUser(Regulus.Remoting.ISoulBinder binder, IStorage storage, IMap zone , Battle.IZone battle)
{
var core = new Regulus.Project.Crystal.Game.Core(binder, storage, zone, battle);
_Users.AddFramework(core);
core.InactiveEvent += () => { _Users.RemoveFramework(core); };
return core;
}
示例15: CompoundFile
internal CompoundFile(IStorage storage, System.Runtime.InteropServices.ComTypes.STATSTG statstg)
{
if (storage == null) { throw new ArgumentNullException("storage"); }
_rootStorage = storage;
_statstg = statstg;
}