From: Michael D. <mik...@us...> - 2004-10-19 05:35:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Eg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25965 Added Files: App.config AssemblyInfo.cs Edge.cs Edge.hbm.xml NetworkDemo.cs NHibernate.Eg-1.1.csproj Source.cs Vertex.cs Vertex.hbm.xml Log Message: removed Eg namespace from NHibernate. Has been added to its own project NHibernate.Eg that will be a part of the Examples solution. --- NEW FILE: Edge.cs --- using System; namespace NHibernate.Eg { public class Edge { private float length; private string name; private float capacity; private Vertex source; private Vertex sink; private long key; private DateTime creationDate = DateTime.Now; public float Capacity { get { return capacity; } set { capacity = value; } } public float Length { get { return length; } set { length = value; } } public string Name { get { return name; } set { name = value; } } public Vertex Source { get { return source; } set { source = value; } } public Vertex Sink { get { return sink; } set { sink = value; } } public long Key { get { return key; } set { key = value; } } public DateTime CreationDate { get { return creationDate; } set { creationDate = value; } } } } --- NEW FILE: Vertex.cs --- using System; using System.Collections; namespace NHibernate.Eg { public class Vertex { private IList incoming = new ArrayList(); private IList outgoing = new ArrayList(); private string name; private long key; private int version; private DateTime creationDate = DateTime.Now; protected IList Incoming { get { return incoming; } set { incoming = value; } } protected IList Outgoing { get { return outgoing; } set { outgoing = value; } } public void AddIncoming(Edge e) { incoming.Add(e); e.Sink = this; } public void AddOutgoing(Edge e) { outgoing.Add(e); e.Source = this; } public void RemoveIncoming(Edge e) { incoming.Remove(e); e.Sink = null; } public void RemoveOutgoing(Edge e) { outgoing.Remove(e); e.Source = null; } public string Name { get { return name; } set { name = value; } } public virtual float ExcessCapacity { get { float excess = 0.0f; foreach( Edge edge in incoming) { excess -= edge.Capacity; } foreach( Edge edge in outgoing) { excess += edge.Capacity; } return excess; } } public long Key { get { return key; } set { key = value; } } public int Version { get { return version; } set { version = value; } } public DateTime CreationDate { get { return creationDate; } set { creationDate = value; } } } } --- NEW FILE: App.config --- <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <nhibernate> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <!-- The valid strings for Isolation can be found in the documentation for the System.Data.IsolationLevel Enumeration documentation. Use the member names - not the values. --> <!-- --> <add key="hibernate.connection.isolation" value="ReadCommitted" /> <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" /> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="hibernate.connection.connection_string" value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> <!-- This is the System.Data.OracleClient.dll provider for Oracle from MS --> <!-- <add key="hibernate.dialect" value="NHibernate.Dialect.OracleDialect" /> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.OracleClientDriver" /> <add key="hibernate.connection.connection_string" value="Data Source=ora9i;User ID=scott;Password=tiger;" /> --> <!-- This is the ByteFX.Data.dll provider for MySql --> <!-- <add key="hibernate.connection.driver_class" value="NHibernate.Driver.ByteFXDataDriver" /> <add key="hibernate.connection.connection_string" value="Database=test;Data Source=someip;User Id=someuser;Password=somepwd" /> <add key="hibernate.dialect" value="NHibernate.Dialect.MySQLDialect" /> --> <!-- This is the Firebird configuration --> <!-- <add key="hibernate.dialect" value="NHibernate.Dialect.FirebirdDialect" /> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.FirebirdDriver" /> <add key="hibernate.connection.connection_string" value="Data Source=localhost;Database=nhibernate;User=SYSDBA;password=masterkey;Charset=ISO8859_1;ServerType=0" /> --> </nhibernate> <!-- This section contains the log4net configuration settings --> <log4net debug="true"> <!-- Define some output appenders --> <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" > <param name="File" value="log.txt" /> <param name="AppendToFile" value="true" /> <param name="RollingStyle" value="Date" /> <param name="DatePattern" value="yyyy.MM.dd" /> <param name="StaticLogFileName" value="true" /> <layout type="log4net.Layout.PatternLayout,log4net"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> </layout> </appender> <!-- Setup the root category, add the appenders and set the default priority --> <root> <priority value="DEBUG" /> <appender-ref ref="rollingFile" /> </root> </log4net> </configuration> --- NEW FILE: NHibernate.Eg-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{4788CEC1-BC6E-420A-B351-4FDF391E4951}" > <Build> <Settings ApplicationIcon = "App.ico" AssemblyKeyContainerName = "" AssemblyName = "NHibernate.Eg" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Exe" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "NHibernate.Eg" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "HashCodeProvider" AssemblyName = "HashCodeProvider" HintPath = "..\..\lib\HashCodeProvider.dll" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\net\1.1\log4net.dll" /> <Reference Name = "NHibernate-1.1" Project = "{EE3B9473-7C64-44FF-B342-91B558D413A8}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> </References> </Build> <Files> <Include> <File RelPath = "App.config" BuildAction = "None" /> <File RelPath = "App.ico" BuildAction = "Content" /> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Edge.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Edge.hbm.xml" BuildAction = "EmbeddedResource" /> <File RelPath = "NetworkDemo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Source.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Vertex.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Vertex.hbm.xml" BuildAction = "EmbeddedResource" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: Vertex.hbm.xml --- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="NHibernate.Eg.Vertex" table="vertex"> <!--<jcs-cache usage="read-write"/>--> <id column="vertex_id" name="Key"> <generator class="hilo" /> </id> <discriminator column="vertex_type" /> <version column="version_number" name="Version" /> <property name="Name" unique="true" not-null="true" length="50" /> <bag name="Incoming" lazy="true" inverse="true" cascade="all" order-by="name"> <key column="sink" /> <one-to-many class="NHibernate.Eg.Edge" /> </bag> <bag name="Outgoing" lazy="true" inverse="true" cascade="all" order-by="name desc"> <key column="source" /> <one-to-many class="NHibernate.Eg.Edge" /> </bag> <property name="CreationDate" type="DateTime" /> <subclass name="NHibernate.Eg.Source"> <property column="Strength" name="SourceStrength" /> </subclass> </class> </hibernate-mapping> --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: Edge.hbm.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Source.cs --- using System; namespace NHibernate.Eg { public class Source : Vertex { private float strength; public float SourceStrength { get { return strength; } set { strength = value; } } public override float ExcessCapacity { get { return base.ExcessCapacity - strength; } } } } --- NEW FILE: NetworkDemo.cs --- using System; using System.IO; using System.Collections; using NHibernate.Cfg; namespace NHibernate.Eg { /// <summary> /// A simple command line application designed to get you started with NHibernate /// </summary> public class NetworkDemo { private static ISessionFactory sessions; private static Configuration ds; [STAThread] public static void Main(string[] args) { // configure the configuration ds = new Configuration() .AddClass(typeof(Vertex)) .AddClass(typeof(Edge)); //build a session factory sessions = ds.BuildSessionFactory(); } public void StartTest() { NetworkDemo.Main(null); } } } |