2012-04-13 3 views
1

ravendb에서 문서를 만들었습니다. session.advanced.getmetadata (코드 참조)를 사용하여 메타 데이터에서 Raven-Entity-Name에 이름을 부여한 후 동일한 함수에서 해당 문서를 삭제했습니다. 그런 다음 컬렉션도 제거되었습니다. 문서를 수동으로 삭제하면 까마귀 스튜디오 그러면 컬렉션은 데이터베이스에 남아 있습니다. 코드 부분의 문서가 없어도 컬렉션은 유지됩니까? 미리 감사드립니다 !!ravendb에 문서가없는 경우 모음을 만들 수 없습니다.

내 C# 코드는 다음과 같습니다

RavenDB에서
public CreateCollectionResult CreateCollection(string databaseName, string collectionName) 
    { 
     CreateCollectionResult createCollectionResult = new CreateCollectionResult(); 

     Collection collection1234 = new Collection(); 
     try 
     { 
      using (var session = documentStore.OpenSession(databaseName)) 
      { 
       Guid guid = new Guid("12345678-1111-1111-2222-000000000000"); 
       session.Store(collection1234, guid, "april-Days/10"); 
       session.Advanced.GetMetadataFor<Collection>(collection1234)[Constants.RavenEntityName] = collectionName; 
       //session.Delete<Collection>(collection1234); 
       session.SaveChanges(); 
       createCollectionResult.IsOperationSuccessfull = true; 
      } 
     } 
     //exception if database not found 
     catch (InvalidOperationException ex) 
     { 
      createCollectionResult.IsOperationSuccessfull = false; 
      createCollectionResult.Error = ex; 
     } 
     return createCollectionResult; 
    } 

답변

1

이 컬렉션은 가상, 그들은만큼 해당 문서에 하나 이상의 문서를 가지고 만있다.

+0

정말 고마워요. :) –

관련 문제