Initial Commit

master
Harald Wolff 2018-07-30 23:20:59 +02:00
parent 13fb6b577d
commit 55ee558654
2 changed files with 34 additions and 5 deletions

37
WaWi.cs
View File

@ -2,22 +2,29 @@
using appsrv.attributes;
using sharpwawi.models;
using mapper.configuration;
using mapper;
using mapper.database;
using appsrv.test;
using mapper.database.model;
namespace sharpwawi
{
public class WaWi
{
[PublishedMember]
public readonly Parts Parts;
Configuration mapperConfiguration;
public Mapper Mapper { get; protected set; }
public WaWi()
{
Parts = new Parts(this);
PrepareMapper();
TestMapper();
}
private void PrepareMapper()
@ -26,13 +33,35 @@ namespace sharpwawi
.AddClass(typeof(Entity))
.AddClass(typeof(Part))
.AddClass(typeof(Assembly))
.AddClass(typeof(AssemblyComponent));
.AddClass(typeof(AssemblyComponent))
.SetConnectionProvider(new PGSQLConnectionProvider("feuerbach.lupus","demo","demo","demo"));
Mapper = new Mapper(mapperConfiguration);
}
private void TestMapper()
{
Console.WriteLine("TestMapper():");
Table table = Table.GetOrCreate("HWO");
new Column(table, "id", typeof(Guid));
new Column(table, "name", typeof(string));
new Column(table, "salery", typeof(double));
Row row = new Row(table);
row["id"] = Guid.NewGuid();
row["name"] = "Harald Wolff";
row["salery"] = 12.34;
Mapper.AcquireTransaction();
Mapper.SQLBuilder.Update(row);
Mapper.RollbackTransaction();
}
[WebCallable]

View File

@ -5,7 +5,7 @@
<Resource Default="/index.hfrm">
<Provider Name="StaticDirectory">www</Provider>
<Resource>
<Provider Name="StaticClass">sharpwawi.WaWi</Provider>
<Provider Name="ClassInstance">sharpwawi.WaWi</Provider>
</Resource>
<Resource>
<Provider Name="StaticClass">sharpwawi.Parts</Provider>