DataServiceContext.AttachTo 메서드 (String, Object, String)
지정된 리소스의 추적을 시작하도록 DataServiceContext에 알리고 지정된 리소스 집합 내의 리소스 위치를 제공합니다.
네임스페이스: System.Data.Services.Client
어셈블리: Microsoft.Data.Services.Client(Microsoft.Data.Services.Client.dll)
구문
‘선언
Public Sub AttachTo ( _
entitySetName As String, _
entity As Object, _
etag As String _
)
‘사용 방법
Dim instance As DataServiceContext
Dim entitySetName As String
Dim entity As Object
Dim etag As String
instance.AttachTo(entitySetName, entity, _
etag)
public void AttachTo(
string entitySetName,
Object entity,
string etag
)
public:
void AttachTo(
String^ entitySetName,
Object^ entity,
String^ etag
)
member AttachTo :
entitySetName:string *
entity:Object *
etag:string -> unit
public function AttachTo(
entitySetName : String,
entity : Object,
etag : String
)
매개 변수
- entitySetName
유형: System.String
엔터티를 추가할 엔터티 집합의 이름을 포함하는 문자열 값입니다.
- entity
유형: System.Object
추가할 엔터티입니다.
- etag
유형: System.String
데이터 서비스에서 마지막으로 검색된 엔터티 상태를 나타내는 etag 값입니다.이 값은 불투명 문자열로 처리됩니다. 따라서 클라이언트 라이브러리에서 유효성 검사를 수행하지 않습니다.
예외
예외 | 조건 |
---|---|
ArgumentNullException | entitySetName이 nullnull 참조(Visual Basic에서는 Nothing)인 경우 또는 entity가 nullnull 참조(Visual Basic에서는 Nothing)인 경우 |
ArgumentException | entitySetName이 빈 문자열인 경우 또는 제공된 개체에 키 속성이 없는 경우 |
InvalidOperationException | 제공된 개체가 컨텍스트에서 이미 추적 중인 경우 |
주의
이 메서드를 호출하면 지정된 엔터티의 추적을 시작하도록 DataServiceContext에 알리고 엔터티가 속한 엔터티 집합을 식별합니다.
엔터티가 개체 그래프의 일부인 경우 이 작업은 그래프를 트래버스하여 관련 개체를 추가하지 못합니다. 개체는 변경되지 않은 상태로 DataServiceContext에 추가됩니다. 이 메서드는 지정된 엔터티 집합이 DataServiceContext와 연관된 데이터 서비스에서 발생하는지 여부를 확인하지 않습니다.
etag와 함께 오버로드를 사용하면 지정한 etag가 새로 연결된 엔터티와 연결됩니다. 그런 다음 etag가 HTTP 의미 체계에 따라 해당 엔터티에 대한 모든 후속 업데이트 또는 쿼리 작업과 함께 데이터 서비스에 전송됩니다. etag 값을 수동으로 생성하지 않는 좋지만 이 오버로드를 제공하면 serialize 및 저장되었을 수 있는 엔터티를 관련 동시성 메타데이터와 함께 다시 연결할 수 있습니다.