The set of conventions used by the EmbeddedDocumentStore which allow the users to customize the way the Raven client API behaves
示例#1
0
		public EmbeddedDocumentStore(string name)
		{
			try
			{
				Conventions = new DocumentConvention
				{
					DocumentKeyGenerator = entity =>
					{
						var typeTagName = Conventions.GetTypeTagName(entity.GetType());
						if (typeTagName == null)
							return Guid.NewGuid().ToString();
						return typeTagName + "/" + Guid.NewGuid();
					}
				};

				persistentSource = new IsolatedStoragePersistentSource(name, "ravenlight");
				storage = new TableStorage(persistentSource);
			}
			catch
			{
				Dispose();
				throw;
			}
		}
示例#2
0
 /// <summary>
 /// Generates the document key using identity.
 /// </summary>
 /// <param name="conventions">The conventions.</param>
 /// <param name="entity">The entity.</param>
 /// <returns></returns>
 public static string GenerateDocumentKeyUsingIdentity(DocumentConvention conventions, object entity)
 {
     return(conventions.FindTypeTagName(entity.GetType()).ToLower() + "/");
 }
		/// <summary>
		/// Generates the document key using identity.
		/// </summary>
		/// <param name="conventions">The conventions.</param>
		/// <param name="entity">The entity.</param>
		/// <returns></returns>
		public static string GenerateDocumentKeyUsingIdentity(DocumentConvention conventions, object entity)
		{
			return conventions.FindTypeTagName(entity.GetType()).ToLower() + "/";
		}