CachedDataItem Sınıf
Visual Studio'da Office geliştirme araçları kullanılarak oluşturulmuş bir belge düzeyinde özelleştirme önbelleğe alınmış veri nesnesinde temsil eder.
Devralma Hiyerarşisi
System.Object
Microsoft.VisualStudio.Tools.Applications.CachedDataNodeBase
Microsoft.VisualStudio.Tools.Applications.CachedDataItem
Ad alanı: Microsoft.VisualStudio.Tools.Applications
Derleme: Microsoft.VisualStudio.Tools.Applications.ServerDocument (Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll içinde)
Sözdizimi
'Bildirim
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public NotInheritable Class CachedDataItem _
Inherits CachedDataNodeBase
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public sealed class CachedDataItem : CachedDataNodeBase
CachedDataItem türü aşağıdaki üyeleri ortaya koyar.
Özellikler
Ad | Açıklama | |
---|---|---|
DataType | Alır veya önbelleğe alınmış verileri nesne türü derleme nitelikli adını ayarlar. | |
Id | Alır veya ayarlar tarafından temsil edilen önbelleğe alınmış verileri nesnenin adı CachedDataItem. | |
Schema | Alır veya ayarlar tarafından temsil edilen önbelleğe alınan verileri nesneyi tanımlayan bir şema CachedDataItem, önbelleğe alınmış veri nesnesi ise bir DataSet veya DataTable. | |
Xml | Alır veya ayarlar tarafından temsil edilen önbelleğe alınmış veri nesnesi xml gösterimini CachedDataItem. |
Üst
Yöntemler
Ad | Açıklama | |
---|---|---|
Equals | Belirler olup belirtilen Object eşittir geçerli Object. (Object kaynağından devralındı.) | |
Finalize | Kaynakları boşaltın ve atık toplama işlemi tarafından iadesi önce diğer temizleme işlemleri gerçekleştirmek nesne izin verir. (Object kaynağından devralındı.) | |
GetHashCode | Belirli bir tip için sağlama işlevini yerine getirir. (Object kaynağından devralındı.) | |
GetType | Alır Type geçerli bir örneği. (Object kaynağından devralındı.) | |
MemberwiseClone | Geçerli yüzeysel bir kopyasını oluşturur Object. (Object kaynağından devralındı.) | |
SerializeDataInstance | Tarafından temsil edilen önbelleğe alınmış veri nesnesine veri serileştirildiğini CachedDataItem. | |
ToString | Geçerli nesneyi temsil eden bir dize döndürür. (Object kaynağından devralındı.) |
Üst
Açıklamalar
Belge düzeyinde özelleştirmeleri verileri önbelleğe alma hakkında daha fazla bilgi için bkz: Veriyi Önbelleğe Alma ve Sunucu Üzerindeki Belgelerin İçerisindeki Verilere Erişim.
Örnekler
Aşağıdaki kod örneği her inceler CachedDataItem bir Excel çalışma kitabını ve görüntüler veri önbelleğindeki her adını önbelleğe veri nesnesi.
Bu örnek aşağıdakileri gerektirir:
Bir konsol uygulaması projesi veya başka bir Office dışı projeye.
Aşağıdaki derlemelerine başvurular:
Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll ve Microsoft.VisualStudio.Tools.Applications.Runtime.dll (eğer proje .NET Framework 4'i hedefliyorsa).
ya da
Microsoft.Visualstudio.Tools.Applications.ServerDocument.V10.0.dll ve Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll (, proje hedefleri.net Framework 3.5).
Imports(Visual Basic için) veya using (için C#) ifadeleri için Microsoft.VisualStudio.Tools.Applications ve Microsoft.VisualStudio.Tools.Applications.Runtime ad alanları üst kod dosyası.
Private Sub DisplayDataCacheContents(ByVal documentPath As String)
Dim runtimeVersion As Integer = 0
Dim serverDocument1 As ServerDocument = Nothing
Try
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath)
If runtimeVersion <> 3 Then
MessageBox.Show("This document does not have a Visual Studio Tools for Office " & _
"customization, or it has a customization that was created with a version of " & _
"the runtime that is incompatible with this version of the ServerDocument class.")
Return
End If
If ServerDocument.IsCacheEnabled(documentPath) Then
serverDocument1 = New ServerDocument(documentPath)
Dim stringBuilder1 As New System.Text.StringBuilder()
' Display all of the cached data items
' in the document.
Dim hostItem1 As CachedDataHostItem
For Each hostItem1 In serverDocument1.CachedData.HostItems
stringBuilder1.Append(vbLf & "Namespace and class: ")
stringBuilder1.Append(hostItem1.Id & vbLf)
Dim dataItem1 As CachedDataItem
For Each dataItem1 In hostItem1.CachedData
stringBuilder1.Append(" Data item: ")
stringBuilder1.Append(dataItem1.Id & vbLf)
Next dataItem1
Next hostItem1
MessageBox.Show(stringBuilder1.ToString())
Else
MessageBox.Show("The specified document does not have cached data.")
End If
Catch ex As System.IO.FileNotFoundException
System.Windows.Forms.MessageBox.Show("The specified document does not exist.")
Catch ex As UnknownCustomizationFileException
System.Windows.Forms.MessageBox.Show("The specified document has a file " & _
"extension that is not supported by Visual Studio Tools for Office.")
Finally
If Not (serverDocument1 Is Nothing) Then
serverDocument1.Close()
End If
End Try
End Sub
private void DisplayDataCacheContents(string documentPath)
{
int runtimeVersion = 0;
ServerDocument serverDocument1 = null;
try
{
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath);
if (runtimeVersion != 3)
{
MessageBox.Show("This document does not have a Visual Studio Tools for " +
"Office customization, or it has a customization that was created with " +
"a version of the runtime that is incompatible with this version of the " +
"ServerDocument class.");
return;
}
if (ServerDocument.IsCacheEnabled(documentPath))
{
serverDocument1 = new ServerDocument(documentPath);
System.Text.StringBuilder stringBuilder1 =
new System.Text.StringBuilder();
// Display all of the cached data items
// in the document.
foreach (CachedDataHostItem hostItem1 in
serverDocument1.CachedData.HostItems)
{
stringBuilder1.Append("\nNamespace and class: ");
stringBuilder1.Append(hostItem1.Id + "\n");
foreach (CachedDataItem dataItem1 in
hostItem1.CachedData)
{
stringBuilder1.Append(" Data item: ");
stringBuilder1.Append(dataItem1.Id + "\n");
}
}
MessageBox.Show(stringBuilder1.ToString());
}
else
{
MessageBox.Show("The specified document does not have cached data.");
}
}
catch (System.IO.FileNotFoundException)
{
System.Windows.Forms.MessageBox.Show("The specified document does not exist.");
}
catch (UnknownCustomizationFileException)
{
System.Windows.Forms.MessageBox.Show("The specified document has a file " +
"extension that is not supported by Visual Studio Tools for Office.");
}
finally
{
if (serverDocument1 != null)
serverDocument1.Close();
}
}
İş Parçacığı Güvenliği
Bu türün tüm genel statik (Visual Basic'te Shared) üyeleri iş parçacığı açısından güvenlidir. Hiçbir örnek üyesinin iş parçacığı açısından güvenliği garanti edilemez.
Ayrıca bkz.
Başvuru
Microsoft.VisualStudio.Tools.Applications Ad Alanı
Diğer Kaynaklar
ServerDocument Sınıfını Kullanarak Sunucu Üzerinde Belge Yönetme