コード例 #1
0
ファイル: IoAdapterStorage.cs プロジェクト: erdincay/db4o
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public virtual IBin Open(BinConfiguration config)
		{
			IoAdapterStorage.IoAdapterBin bin = new IoAdapterStorage.IoAdapterBin(_io.Open(config
				.Uri(), config.LockFile(), config.InitialLength(), config.ReadOnly()));
			((IBlockSize)Environments.My(typeof(IBlockSize))).Register(bin);
			return bin;
		}
コード例 #2
0
ファイル: FileStorage.cs プロジェクト: bvangrinsven/db4o-net
			/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
			public FileBin(BinConfiguration config)
			{
				bool ok = false;
				try
				{
					_path = new Sharpen.IO.File(config.Uri()).GetCanonicalPath();
					_file = RandomAccessFileFactory.NewRandomAccessFile(_path, config.ReadOnly(), config
						.LockFile());
					if (config.InitialLength() > 0)
					{
						Write(config.InitialLength() - 1, new byte[] { 0 }, 1);
					}
					ok = true;
				}
				catch (IOException e)
				{
					throw new Db4oIOException(e);
				}
				finally
				{
					if (!ok)
					{
						Close();
					}
				}
			}
コード例 #3
0
ファイル: IoAdapterStorage.cs プロジェクト: pondyond/db4o
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        public virtual IBin Open(BinConfiguration config)
        {
            var bin = new IoAdapterBin(_io.Open(config
                                                .Uri(), config.LockFile(), config.InitialLength(), config.ReadOnly()));

            ((IBlockSize)Environments.My(typeof(IBlockSize))).Register(bin);
            return(bin);
        }
コード例 #4
0
		private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
		{
			return new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
				(), oldConfig.ReadOnly());
		}
コード例 #5
0
            /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
            public FileBin(BinConfiguration config)
            {
                bool ok = false;

                try
                {
                    _path = new Sharpen.IO.File(config.Uri()).GetCanonicalPath();
                    _file = RandomAccessFileFactory.NewRandomAccessFile(_path, config.ReadOnly(), config
                                                                        .LockFile());
                    if (config.InitialLength() > 0)
                    {
                        Write(config.InitialLength() - 1, new byte[] { 0 }, 1);
                    }
                    ok = true;
                }
                catch (IOException e)
                {
                    throw new Db4oIOException(e);
                }
                finally
                {
                    if (!ok)
                    {
                        Close();
                    }
                }
            }
コード例 #6
0
 private BinConfiguration PointToNewUri(BinConfiguration oldConfig, string newUri)
 {
     return(new BinConfiguration(newUri, oldConfig.LockFile(), oldConfig.InitialLength
                                     (), oldConfig.ReadOnly()));
 }
コード例 #7
0
 private static FileShare FileShareFor(BinConfiguration config)
 {
     return(config.LockFile() ? FileShare.None : FileShare.ReadWrite);
 }
コード例 #8
0
 	private static FileShare FileShareFor(BinConfiguration config)
 	{
 		return config.LockFile() ? FileShare.None : FileShare.ReadWrite;
 	}