C# Класс JPB.DataAccess.Helper.LocalDb.LocalDbManager

Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AddMapping void
AddTable void
GetMappings IEnumerable
LocalDbManager System
OnSetupDone void

Открытые методы

Метод Описание
Alter ( ) : EditDatabaseScope

allowes to Add or remove tabels from this Database. If you try to use the tables before calling dispose on the returned Scope an InvalidOperationException will be thrown

GetSerializableContent ( ) : DataContent

Creates a new Class that supportes the IXmlSerializable interface. It is linked to this database and can be used to read or write all content in this database. To Write all elements using (var memStream = new MemoryStream()) { new XmlSerializer(typeof(DataContent)).Serialize(memStream, LocalDbManager.Scope.GetSerializableContent()); var xml = Encoding.ASCII.GetString(memStream.ToArray()); } When reading the data the database creation has to be in progress. You must execute the statement inside the DatabaseScope you want to fill using (new DatabaseScope()) { //Table creation ... //new LocalDbReposetory<T>(new DbConfig()) using (var memStream = new MemoryStream(Encoding.ASCII.GetBytes("xml"))) { new XmlSerializer(typeof(DataContent)).Deserialize(memStream); } }

Приватные методы

Метод Описание
AddMapping ( Type source, Type target ) : void
AddTable ( ILocalDbReposetoryBaseInternalUsage repro ) : void
GetMappings ( Type thisType ) : IEnumerable
LocalDbManager ( ) : System
OnSetupDone ( ) : void

Описание методов

Alter() публичный Метод

allowes to Add or remove tabels from this Database. If you try to use the tables before calling dispose on the returned Scope an InvalidOperationException will be thrown
public Alter ( ) : EditDatabaseScope
Результат EditDatabaseScope

GetSerializableContent() публичный Метод

Creates a new Class that supportes the IXmlSerializable interface. It is linked to this database and can be used to read or write all content in this database. To Write all elements using (var memStream = new MemoryStream()) { new XmlSerializer(typeof(DataContent)).Serialize(memStream, LocalDbManager.Scope.GetSerializableContent()); var xml = Encoding.ASCII.GetString(memStream.ToArray()); } When reading the data the database creation has to be in progress. You must execute the statement inside the DatabaseScope you want to fill using (new DatabaseScope()) { //Table creation ... //new LocalDbReposetory<T>(new DbConfig()) using (var memStream = new MemoryStream(Encoding.ASCII.GetBytes("xml"))) { new XmlSerializer(typeof(DataContent)).Deserialize(memStream); } }
public GetSerializableContent ( ) : DataContent
Результат DataContent