Last change
on this file since 367 was
357,
checked in by gkronber, 16 years ago
|
worked on ticket #187. code is a mess. work-in-progress.
|
File size:
1.0 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Data.Linq;
|
---|
6 | using HeuristicLab.CEDMA.DB.Interfaces;
|
---|
7 | using System.ServiceModel;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.CEDMA.DB {
|
---|
10 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
|
---|
11 | public class Database : DataContext, IDatabase {
|
---|
12 | Table<Agent> Agents;
|
---|
13 |
|
---|
14 | public Database() : this("c:\\cedma.mdf") { }
|
---|
15 |
|
---|
16 | public Database(string connection) : base(connection) {
|
---|
17 | }
|
---|
18 |
|
---|
19 | public IList<IAgent> GetAgents() {
|
---|
20 | List<IAgent> result = new List<IAgent>();
|
---|
21 | foreach(Agent a in Agents) {
|
---|
22 | result.Add(a);
|
---|
23 | }
|
---|
24 | return result;
|
---|
25 | }
|
---|
26 |
|
---|
27 | public IAgent CreateAgent() {
|
---|
28 | Agent newAgent = new Agent();
|
---|
29 | newAgent.Name = DateTime.Now.ToString();
|
---|
30 | newAgent.Status = AgentStatus.Waiting;
|
---|
31 | newAgent.RawData = null;
|
---|
32 | Agents.InsertOnSubmit(newAgent);
|
---|
33 | this.SubmitChanges();
|
---|
34 | return newAgent;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.