Udostępnij przez


Za pomocą adnotacji sql:identity i sql:guid

You can specify the sql:identity and sql:guid annotations in an XSD schema on any node that maps to a database column in Microsoft SQL Server.Dlatego obsługuje updategram format updg:at-identity i updg:guid atrybuty, nie obsługuje formatu w formacie DiffGram. The updg:at-identity atrybut defines the behavior in updating an IDENTITY-type kolumna. The updg:guid atrybut allows you to obtain a GUID value from SQL Server and use it in the updategram. Aby uzyskać więcej informacji i przykłady pracy zobacz Wstawianie danych za pomocą Updategrams XML (SQLXML 4.0).

The sql:identity and sql:guid annotations extend this functionality to DiffGrams.

Podczas wykonywania element w formacie DiffGram, najpierw jest ona konwertowana updategram, a następnie updategram jest wykonać.Określając sql:identity i sql:guid adnotacje w schematu XSD, w rzeczywistości definiowanej zachowanie updategram. Dlatego wszystkie adnotacje są opisane w kontekście updategram.Adnotacje mogą być używane zarówno dla DiffGrams i updategrams; updategrams już zapewnia jednak bardziej wydajny sposób obsługi tożsamości i wartości identyfikatora GUID.

The sql:identity and sql:guid annotations can be defined on a complex content element.

SQL:Identity adnotacji

Można określić sql:identity adnotacji w schematu XSD w dowolnym węźle, który mapuje kolumna bazy danych typu IDENTITY. Wartość określona dla tej adnotacji definiuje sposób aktualizacji kolumna Typ IDENTITY (przy użyciu wartości podane w updategram zmodyfikować kolumna lub ignorowanie wartości, w którym to przypadek SQL Serverwartość –Generated jest używany dla tej kolumna).

The sql:identity annotation can be assigned two values:

  • Ignoruj
    Określa, że updategram zignorowanie każdą wartość, która znajduje się w updategram dla tej kolumna oraz polegać na SQL Server Aby wygenerować wartość tożsamości.

  • useValue
    Określa, że updategram używania wartość, która jest dostępna w updategram zaktualizować kolumna Typ IDENTITY.An updategram nie sprawdza, czy kolumna jest wartością tożsamości.

Jeśli updategram określa wartość dla kolumna typu IDENTITY sql:identity="useValue" musi być określona w schemacie.

SQL:GUID adnotacji

Może mieć updategram SQL Server Generowanie wartość identyfikatora GUID, a następnie użyj tej wartości w updategram. W kontekście DiffGrams, można użyć sql:guid adnotację, aby określić, czy używać wartości identyfikatora GUID jest generowany przez program SQL Server lub wartość, która znajduje się w updategram dla tej kolumna.

The sql:guid annotation can be assigned two values:

  • Generowanie
    Określa, że identyfikator GUID jest generowany przez SQL Server można użyć dla tej kolumna w operacji aktualizacji.

  • useValue
    Określa, że wartości określonej w polu updategram będą stosowane dla kolumna.Jest to wartość domyślna.