Added SQL Interface to NAV Object table with support for serialization. Tested this.
This commit is contained in:
14
NAVSCM Library/NavInterface/NavObject.cs
Normal file
14
NAVSCM Library/NavInterface/NavObject.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NavScm.NavInterface
|
||||
{
|
||||
partial class NavObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
18
NAVSCM Library/NavInterface/NavSQL.dbml
Normal file
18
NAVSCM Library/NavInterface/NavSQL.dbml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><Database Name="TERRABIT 2015 DEV" EntityNamespace="NavScm.NavInterface" ContextNamespace="NavScm.NavInterface" Class="NavSQLDataContext" Serialization="Unidirectional" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
|
||||
<Table Name="dbo.Object" Member="NavObject">
|
||||
<Type Name="NavObject">
|
||||
<Column Name="timestamp" Type="System.Data.Linq.Binary" DbType="rowversion NOT NULL" IsReadOnly="true" CanBeNull="false" IsVersion="true" />
|
||||
<Column Name="Type" Type="System.Int32" DbType="Int NOT NULL" IsReadOnly="true" IsPrimaryKey="true" CanBeNull="false" />
|
||||
<Column Name="[Company Name]" Member="Company_Name" Type="System.String" DbType="VarChar(30) NOT NULL" IsReadOnly="true" IsPrimaryKey="true" CanBeNull="false" />
|
||||
<Column Name="ID" Type="System.Int32" DbType="Int NOT NULL" IsReadOnly="true" IsPrimaryKey="true" CanBeNull="false" />
|
||||
<Column Name="Name" Type="System.String" DbType="VarChar(30) NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="Modified" Type="System.Byte" DbType="TinyInt NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="Compiled" Type="System.Byte" DbType="TinyInt NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="Date" Type="System.DateTime" DbType="DateTime NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="Time" Type="System.DateTime" DbType="DateTime NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="[Version List]" Member="Version_List" Type="System.String" DbType="VarChar(248) NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="Locked" Type="System.Byte" DbType="TinyInt NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
<Column Name="[Locked By]" Member="Locked_By" Type="System.String" DbType="VarChar(132) NOT NULL" IsReadOnly="true" CanBeNull="false" />
|
||||
</Type>
|
||||
</Table>
|
||||
</Database>
|
12
NAVSCM Library/NavInterface/NavSQL.dbml.layout
Normal file
12
NAVSCM Library/NavInterface/NavSQL.dbml.layout
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="NavSQL">
|
||||
<DataContextMoniker Name="/NavSQLDataContext" />
|
||||
<nestedChildShapes>
|
||||
<classShape Id="8c6e51fb-7d5f-4746-8740-0eda298f32a6" absoluteBounds="1.875, 0.75, 2, 3.1170068359375">
|
||||
<DataClassMoniker Name="/NavSQLDataContext/NavObject" />
|
||||
<nestedChildShapes>
|
||||
<elementListCompartment Id="4da92c62-b2ce-4bc2-9a36-eba03eac978d" absoluteBounds="1.8900000000000001, 1.21, 1.9700000000000002, 2.5570068359375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
|
||||
</nestedChildShapes>
|
||||
</classShape>
|
||||
</nestedChildShapes>
|
||||
</ordesignerObjectsDiagram>
|
423
NAVSCM Library/NavInterface/NavSQL.designer.cs
generated
Normal file
423
NAVSCM Library/NavInterface/NavSQL.designer.cs
generated
Normal file
@ -0,0 +1,423 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NavScm.NavInterface
|
||||
{
|
||||
using System.Data.Linq;
|
||||
using System.Data.Linq.Mapping;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
|
||||
|
||||
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="TERRABIT 2015 DEV")]
|
||||
public partial class NavSQLDataContext : System.Data.Linq.DataContext
|
||||
{
|
||||
|
||||
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
|
||||
|
||||
#region Definitionen der Erweiterungsmethoden
|
||||
partial void OnCreated();
|
||||
partial void InsertNavObject(NavObject instance);
|
||||
partial void UpdateNavObject(NavObject instance);
|
||||
partial void DeleteNavObject(NavObject instance);
|
||||
#endregion
|
||||
|
||||
public NavSQLDataContext(string connection) :
|
||||
base(connection, mappingSource)
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
public NavSQLDataContext(System.Data.IDbConnection connection) :
|
||||
base(connection, mappingSource)
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
public NavSQLDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
|
||||
base(connection, mappingSource)
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
public NavSQLDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
|
||||
base(connection, mappingSource)
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
public System.Data.Linq.Table<NavObject> NavObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetTable<NavObject>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Object")]
|
||||
[global::System.Runtime.Serialization.DataContractAttribute()]
|
||||
public partial class NavObject : INotifyPropertyChanging, INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
|
||||
|
||||
private System.Data.Linq.Binary _timestamp = default(System.Data.Linq.Binary);
|
||||
|
||||
private int _Type = default(int);
|
||||
|
||||
private string _Company_Name = default(string);
|
||||
|
||||
private int _ID = default(int);
|
||||
|
||||
private string _Name = default(string);
|
||||
|
||||
private byte _Modified = default(byte);
|
||||
|
||||
private byte _Compiled = default(byte);
|
||||
|
||||
private System.DateTime _Date = default(System.DateTime);
|
||||
|
||||
private System.DateTime _Time = default(System.DateTime);
|
||||
|
||||
private string _Version_List = default(string);
|
||||
|
||||
private byte _Locked = default(byte);
|
||||
|
||||
private string _Locked_By = default(string);
|
||||
|
||||
#region Definitionen der Erweiterungsmethoden
|
||||
partial void OnLoaded();
|
||||
partial void OnValidate(System.Data.Linq.ChangeAction action);
|
||||
partial void OnCreated();
|
||||
partial void OntimestampChanging(System.Data.Linq.Binary value);
|
||||
partial void OntimestampChanged();
|
||||
partial void OnTypeChanging(int value);
|
||||
partial void OnTypeChanged();
|
||||
partial void OnCompany_NameChanging(string value);
|
||||
partial void OnCompany_NameChanged();
|
||||
partial void OnIDChanging(int value);
|
||||
partial void OnIDChanged();
|
||||
partial void OnNameChanging(string value);
|
||||
partial void OnNameChanged();
|
||||
partial void OnModifiedChanging(byte value);
|
||||
partial void OnModifiedChanged();
|
||||
partial void OnCompiledChanging(byte value);
|
||||
partial void OnCompiledChanged();
|
||||
partial void OnDateChanging(System.DateTime value);
|
||||
partial void OnDateChanged();
|
||||
partial void OnTimeChanging(System.DateTime value);
|
||||
partial void OnTimeChanged();
|
||||
partial void OnVersion_ListChanging(string value);
|
||||
partial void OnVersion_ListChanged();
|
||||
partial void OnLockedChanging(byte value);
|
||||
partial void OnLockedChanged();
|
||||
partial void OnLocked_ByChanging(string value);
|
||||
partial void OnLocked_ByChanged();
|
||||
#endregion
|
||||
|
||||
public NavObject()
|
||||
{
|
||||
this.Initialize();
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_timestamp", AutoSync=AutoSync.Always, DbType="rowversion NOT NULL", CanBeNull=false, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=1)]
|
||||
public System.Data.Linq.Binary timestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._timestamp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._timestamp != value))
|
||||
{
|
||||
this.OntimestampChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._timestamp = value;
|
||||
this.SendPropertyChanged("timestamp");
|
||||
this.OntimestampChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Type", DbType="Int NOT NULL", IsPrimaryKey=true, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=2)]
|
||||
public int Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Type != value))
|
||||
{
|
||||
this.OnTypeChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Type = value;
|
||||
this.SendPropertyChanged("Type");
|
||||
this.OnTypeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="[Company Name]", Storage="_Company_Name", DbType="VarChar(30) NOT NULL", CanBeNull=false, IsPrimaryKey=true, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=3)]
|
||||
public string Company_Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Company_Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Company_Name != value))
|
||||
{
|
||||
this.OnCompany_NameChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Company_Name = value;
|
||||
this.SendPropertyChanged("Company_Name");
|
||||
this.OnCompany_NameChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ID", DbType="Int NOT NULL", IsPrimaryKey=true, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=4)]
|
||||
public int ID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._ID;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._ID != value))
|
||||
{
|
||||
this.OnIDChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._ID = value;
|
||||
this.SendPropertyChanged("ID");
|
||||
this.OnIDChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(30) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=5)]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Name != value))
|
||||
{
|
||||
this.OnNameChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Name = value;
|
||||
this.SendPropertyChanged("Name");
|
||||
this.OnNameChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Modified", DbType="TinyInt NOT NULL", UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=6)]
|
||||
public byte Modified
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Modified;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Modified != value))
|
||||
{
|
||||
this.OnModifiedChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Modified = value;
|
||||
this.SendPropertyChanged("Modified");
|
||||
this.OnModifiedChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Compiled", DbType="TinyInt NOT NULL", UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=7)]
|
||||
public byte Compiled
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Compiled;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Compiled != value))
|
||||
{
|
||||
this.OnCompiledChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Compiled = value;
|
||||
this.SendPropertyChanged("Compiled");
|
||||
this.OnCompiledChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Date", DbType="DateTime NOT NULL", UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=8)]
|
||||
public System.DateTime Date
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Date;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Date != value))
|
||||
{
|
||||
this.OnDateChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Date = value;
|
||||
this.SendPropertyChanged("Date");
|
||||
this.OnDateChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Time", DbType="DateTime NOT NULL", UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=9)]
|
||||
public System.DateTime Time
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Time;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Time != value))
|
||||
{
|
||||
this.OnTimeChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Time = value;
|
||||
this.SendPropertyChanged("Time");
|
||||
this.OnTimeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="[Version List]", Storage="_Version_List", DbType="VarChar(248) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=10)]
|
||||
public string Version_List
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Version_List;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Version_List != value))
|
||||
{
|
||||
this.OnVersion_ListChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Version_List = value;
|
||||
this.SendPropertyChanged("Version_List");
|
||||
this.OnVersion_ListChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Locked", DbType="TinyInt NOT NULL", UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=11)]
|
||||
public byte Locked
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Locked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Locked != value))
|
||||
{
|
||||
this.OnLockedChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Locked = value;
|
||||
this.SendPropertyChanged("Locked");
|
||||
this.OnLockedChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="[Locked By]", Storage="_Locked_By", DbType="VarChar(132) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
|
||||
[global::System.Runtime.Serialization.DataMemberAttribute(Order=12)]
|
||||
public string Locked_By
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Locked_By;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Locked_By != value))
|
||||
{
|
||||
this.OnLocked_ByChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Locked_By = value;
|
||||
this.SendPropertyChanged("Locked_By");
|
||||
this.OnLocked_ByChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangingEventHandler PropertyChanging;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void SendPropertyChanging()
|
||||
{
|
||||
if ((this.PropertyChanging != null))
|
||||
{
|
||||
this.PropertyChanging(this, emptyChangingEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SendPropertyChanged(String propertyName)
|
||||
{
|
||||
if ((this.PropertyChanged != null))
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
[global::System.Runtime.Serialization.OnDeserializingAttribute()]
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
|
||||
public void OnDeserializing(StreamingContext context)
|
||||
{
|
||||
this.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
21
NAVSCM Library/NavInterface/NavSQLDataContext.cs
Normal file
21
NAVSCM Library/NavInterface/NavSQLDataContext.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NavScm.NavInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Default data context to interact with NAV Databases, Object tracking is disabled
|
||||
/// to avoid any caching problems throught program execution. If we query the DB, it
|
||||
/// should always be executed.
|
||||
/// </summary>
|
||||
public partial class NavSQLDataContext
|
||||
{
|
||||
partial void OnCreated()
|
||||
{
|
||||
ObjectTrackingEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user