PageRenderTime 63ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/glados_proto/glados_proto/Generated_Code/glados.Web.g.cs-82f061dc

https://bitbucket.org/s_vladimir/tsys
Unknown | 2851 lines | 2543 code | 308 blank | 0 comment | 0 complexity | baaf8a2f180c6eef30fcdbc5523fbd59 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. // Runtime Version:4.0.30319.431
  5. //
  6. // Changes to this file may cause incorrect behavior and will be lost if
  7. // the code is regenerated.
  8. // </auto-generated>
  9. //------------------------------------------------------------------------------
  10. namespace glados
  11. {
  12. using System;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.ComponentModel.DataAnnotations;
  16. using System.Linq;
  17. using System.ServiceModel.DomainServices;
  18. using System.ServiceModel.DomainServices.Client;
  19. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  20. using glados.Web;
  21. /// <summary>
  22. /// Context for the RIA application.
  23. /// </summary>
  24. /// <remarks>
  25. /// This context extends the base to make application services and types available
  26. /// for consumption from code and xaml.
  27. /// </remarks>
  28. public sealed partial class WebContext : WebContextBase
  29. {
  30. #region Extensibility Method Definitions
  31. /// <summary>
  32. /// This method is invoked from the constructor once initialization is complete and
  33. /// can be used for further object setup.
  34. /// </summary>
  35. partial void OnCreated();
  36. #endregion
  37. /// <summary>
  38. /// Initializes a new instance of the WebContext class.
  39. /// </summary>
  40. public WebContext()
  41. {
  42. this.OnCreated();
  43. }
  44. /// <summary>
  45. /// Gets the context that is registered as a lifetime object with the current application.
  46. /// </summary>
  47. /// <exception cref="InvalidOperationException"> is thrown if there is no current application,
  48. /// no contexts have been added, or more than one context has been added.
  49. /// </exception>
  50. /// <seealso cref="System.Windows.Application.ApplicationLifetimeObjects"/>
  51. public new static WebContext Current
  52. {
  53. get
  54. {
  55. return ((WebContext)(WebContextBase.Current));
  56. }
  57. }
  58. /// <summary>
  59. /// Gets a user representing the authenticated identity.
  60. /// </summary>
  61. public new AuthUser User
  62. {
  63. get
  64. {
  65. return ((AuthUser)(base.User));
  66. }
  67. }
  68. }
  69. }
  70. namespace Glados.TestingModule.Interfaces
  71. {
  72. using System;
  73. using System.Collections.Generic;
  74. using System.ComponentModel;
  75. using System.ComponentModel.DataAnnotations;
  76. using System.Linq;
  77. using System.ServiceModel.DomainServices;
  78. using System.ServiceModel.DomainServices.Client;
  79. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  80. public enum ServerStatus
  81. {
  82. Idle = 0,
  83. Busy = 1,
  84. InternalError = 2,
  85. Unavailable = 3,
  86. Down = 4,
  87. }
  88. }
  89. namespace glados.Web
  90. {
  91. using System;
  92. using System.Collections.Generic;
  93. using System.ComponentModel;
  94. using System.ComponentModel.DataAnnotations;
  95. using System.Linq;
  96. using System.Runtime.Serialization;
  97. using System.ServiceModel;
  98. using System.ServiceModel.DomainServices;
  99. using System.ServiceModel.DomainServices.Client;
  100. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  101. using System.ServiceModel.Web;
  102. using System.Xml.Serialization;
  103. /// <summary>
  104. /// The 'Assignment' entity class.
  105. /// </summary>
  106. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  107. public sealed partial class Assignment : Entity
  108. {
  109. private int _id;
  110. private EntityRef<Participation> _participation;
  111. private int _participationId;
  112. private EntityRef<Problem> _problem;
  113. private int _problemId;
  114. private EntityCollection<Submission> _submission;
  115. #region Extensibility Method Definitions
  116. /// <summary>
  117. /// This method is invoked from the constructor once initialization is complete and
  118. /// can be used for further object setup.
  119. /// </summary>
  120. partial void OnCreated();
  121. partial void OnIdChanging(int value);
  122. partial void OnIdChanged();
  123. partial void OnParticipationIdChanging(int value);
  124. partial void OnParticipationIdChanged();
  125. partial void OnProblemIdChanging(int value);
  126. partial void OnProblemIdChanged();
  127. #endregion
  128. /// <summary>
  129. /// Initializes a new instance of the <see cref="Assignment"/> class.
  130. /// </summary>
  131. public Assignment()
  132. {
  133. this.OnCreated();
  134. }
  135. /// <summary>
  136. /// Gets or sets the 'Id' value.
  137. /// </summary>
  138. [DataMember()]
  139. [Editable(false, AllowInitialValue=true)]
  140. [Key()]
  141. [RoundtripOriginal()]
  142. public int Id
  143. {
  144. get
  145. {
  146. return this._id;
  147. }
  148. set
  149. {
  150. if ((this._id != value))
  151. {
  152. this.OnIdChanging(value);
  153. this.ValidateProperty("Id", value);
  154. this._id = value;
  155. this.RaisePropertyChanged("Id");
  156. this.OnIdChanged();
  157. }
  158. }
  159. }
  160. /// <summary>
  161. /// Gets or sets the associated <see cref="Participation"/> entity.
  162. /// </summary>
  163. [Association("Participation_Assignment", "ParticipationId", "Id", IsForeignKey=true)]
  164. [XmlIgnore()]
  165. public Participation Participation
  166. {
  167. get
  168. {
  169. if ((this._participation == null))
  170. {
  171. this._participation = new EntityRef<Participation>(this, "Participation", this.FilterParticipation);
  172. }
  173. return this._participation.Entity;
  174. }
  175. set
  176. {
  177. Participation previous = this.Participation;
  178. if ((previous != value))
  179. {
  180. this.ValidateProperty("Participation", value);
  181. if ((previous != null))
  182. {
  183. this._participation.Entity = null;
  184. previous.Assignment.Remove(this);
  185. }
  186. if ((value != null))
  187. {
  188. this.ParticipationId = value.Id;
  189. }
  190. else
  191. {
  192. this.ParticipationId = default(int);
  193. }
  194. this._participation.Entity = value;
  195. if ((value != null))
  196. {
  197. value.Assignment.Add(this);
  198. }
  199. this.RaisePropertyChanged("Participation");
  200. }
  201. }
  202. }
  203. /// <summary>
  204. /// Gets or sets the 'ParticipationId' value.
  205. /// </summary>
  206. [DataMember()]
  207. [RoundtripOriginal()]
  208. public int ParticipationId
  209. {
  210. get
  211. {
  212. return this._participationId;
  213. }
  214. set
  215. {
  216. if ((this._participationId != value))
  217. {
  218. this.OnParticipationIdChanging(value);
  219. this.RaiseDataMemberChanging("ParticipationId");
  220. this.ValidateProperty("ParticipationId", value);
  221. this._participationId = value;
  222. this.RaiseDataMemberChanged("ParticipationId");
  223. this.OnParticipationIdChanged();
  224. }
  225. }
  226. }
  227. /// <summary>
  228. /// Gets or sets the associated <see cref="Problem"/> entity.
  229. /// </summary>
  230. [Association("Problem_Assignment", "ProblemId", "Id", IsForeignKey=true)]
  231. [XmlIgnore()]
  232. public Problem Problem
  233. {
  234. get
  235. {
  236. if ((this._problem == null))
  237. {
  238. this._problem = new EntityRef<Problem>(this, "Problem", this.FilterProblem);
  239. }
  240. return this._problem.Entity;
  241. }
  242. set
  243. {
  244. Problem previous = this.Problem;
  245. if ((previous != value))
  246. {
  247. this.ValidateProperty("Problem", value);
  248. if ((previous != null))
  249. {
  250. this._problem.Entity = null;
  251. previous.Assignment.Remove(this);
  252. }
  253. if ((value != null))
  254. {
  255. this.ProblemId = value.Id;
  256. }
  257. else
  258. {
  259. this.ProblemId = default(int);
  260. }
  261. this._problem.Entity = value;
  262. if ((value != null))
  263. {
  264. value.Assignment.Add(this);
  265. }
  266. this.RaisePropertyChanged("Problem");
  267. }
  268. }
  269. }
  270. /// <summary>
  271. /// Gets or sets the 'ProblemId' value.
  272. /// </summary>
  273. [DataMember()]
  274. [RoundtripOriginal()]
  275. public int ProblemId
  276. {
  277. get
  278. {
  279. return this._problemId;
  280. }
  281. set
  282. {
  283. if ((this._problemId != value))
  284. {
  285. this.OnProblemIdChanging(value);
  286. this.RaiseDataMemberChanging("ProblemId");
  287. this.ValidateProperty("ProblemId", value);
  288. this._problemId = value;
  289. this.RaiseDataMemberChanged("ProblemId");
  290. this.OnProblemIdChanged();
  291. }
  292. }
  293. }
  294. /// <summary>
  295. /// Gets the collection of associated <see cref="Submission"/> entities.
  296. /// </summary>
  297. [Association("Assignment_Submission", "Id", "AssignmentId")]
  298. [XmlIgnore()]
  299. public EntityCollection<Submission> Submission
  300. {
  301. get
  302. {
  303. if ((this._submission == null))
  304. {
  305. this._submission = new EntityCollection<Submission>(this, "Submission", this.FilterSubmission, this.AttachSubmission, this.DetachSubmission);
  306. }
  307. return this._submission;
  308. }
  309. }
  310. private bool FilterParticipation(Participation entity)
  311. {
  312. return (entity.Id == this.ParticipationId);
  313. }
  314. private bool FilterProblem(Problem entity)
  315. {
  316. return (entity.Id == this.ProblemId);
  317. }
  318. private void AttachSubmission(Submission entity)
  319. {
  320. entity.Assignment = this;
  321. }
  322. private void DetachSubmission(Submission entity)
  323. {
  324. entity.Assignment = null;
  325. }
  326. private bool FilterSubmission(Submission entity)
  327. {
  328. return (entity.AssignmentId == this.Id);
  329. }
  330. /// <summary>
  331. /// Computes a value from the key fields that uniquely identifies this entity instance.
  332. /// </summary>
  333. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  334. public override object GetIdentity()
  335. {
  336. return this._id;
  337. }
  338. }
  339. /// <summary>
  340. /// The domain context corresponding to the 'AuthenticationDomainService' domain service.
  341. /// </summary>
  342. public sealed partial class AuthenticationDomainContext : global::System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationDomainContextBase
  343. {
  344. #region Extensibility Method Definitions
  345. /// <summary>
  346. /// This method is invoked from the constructor once initialization is complete and
  347. /// can be used for further object setup.
  348. /// </summary>
  349. partial void OnCreated();
  350. #endregion
  351. /// <summary>
  352. /// Initializes a new instance of the <see cref="AuthenticationDomainContext"/> class.
  353. /// </summary>
  354. public AuthenticationDomainContext() :
  355. this(new WebDomainClient<IAuthenticationDomainServiceContract>(new Uri("glados-Web-AuthenticationDomainService.svc", UriKind.Relative)))
  356. {
  357. }
  358. /// <summary>
  359. /// Initializes a new instance of the <see cref="AuthenticationDomainContext"/> class with the specified service URI.
  360. /// </summary>
  361. /// <param name="serviceUri">The AuthenticationDomainService service URI.</param>
  362. public AuthenticationDomainContext(Uri serviceUri) :
  363. this(new WebDomainClient<IAuthenticationDomainServiceContract>(serviceUri))
  364. {
  365. }
  366. /// <summary>
  367. /// Initializes a new instance of the <see cref="AuthenticationDomainContext"/> class with the specified <paramref name="domainClient"/>.
  368. /// </summary>
  369. /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
  370. public AuthenticationDomainContext(DomainClient domainClient) :
  371. base(domainClient)
  372. {
  373. this.OnCreated();
  374. }
  375. /// <summary>
  376. /// Gets the set of <see cref="AuthUser"/> entities that have been loaded into this <see cref="AuthenticationDomainContext"/> instance.
  377. /// </summary>
  378. public EntitySet<AuthUser> AuthUsers
  379. {
  380. get
  381. {
  382. return base.EntityContainer.GetEntitySet<AuthUser>();
  383. }
  384. }
  385. /// <summary>
  386. /// Gets an EntityQuery instance that can be used to load <see cref="AuthUser"/> entities using the 'GetUser' query.
  387. /// </summary>
  388. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="AuthUser"/> entities.</returns>
  389. public EntityQuery<AuthUser> GetUserQuery()
  390. {
  391. this.ValidateMethod("GetUserQuery", null);
  392. return base.CreateQuery<AuthUser>("GetUser", null, false, false);
  393. }
  394. /// <summary>
  395. /// Gets an EntityQuery instance that can be used to load <see cref="AuthUser"/> entities using the 'Login' query.
  396. /// </summary>
  397. /// <param name="userName">The value for the 'userName' parameter of the query.</param>
  398. /// <param name="password">The value for the 'password' parameter of the query.</param>
  399. /// <param name="isPersistent">The value for the 'isPersistent' parameter of the query.</param>
  400. /// <param name="customData">The value for the 'customData' parameter of the query.</param>
  401. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="AuthUser"/> entities.</returns>
  402. public EntityQuery<AuthUser> LoginQuery(string userName, string password, bool isPersistent, string customData)
  403. {
  404. Dictionary<string, object> parameters = new Dictionary<string, object>();
  405. parameters.Add("userName", userName);
  406. parameters.Add("password", password);
  407. parameters.Add("isPersistent", isPersistent);
  408. parameters.Add("customData", customData);
  409. this.ValidateMethod("LoginQuery", parameters);
  410. return base.CreateQuery<AuthUser>("Login", parameters, true, false);
  411. }
  412. /// <summary>
  413. /// Gets an EntityQuery instance that can be used to load <see cref="AuthUser"/> entities using the 'Logout' query.
  414. /// </summary>
  415. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="AuthUser"/> entities.</returns>
  416. public EntityQuery<AuthUser> LogoutQuery()
  417. {
  418. this.ValidateMethod("LogoutQuery", null);
  419. return base.CreateQuery<AuthUser>("Logout", null, true, false);
  420. }
  421. /// <summary>
  422. /// Creates a new entity container for this domain context's entity sets.
  423. /// </summary>
  424. /// <returns>A new container instance.</returns>
  425. protected override EntityContainer CreateEntityContainer()
  426. {
  427. return new AuthenticationDomainContextEntityContainer();
  428. }
  429. /// <summary>
  430. /// Service contract for the 'AuthenticationDomainService' domain service.
  431. /// </summary>
  432. [ServiceContract()]
  433. public interface IAuthenticationDomainServiceContract
  434. {
  435. /// <summary>
  436. /// Asynchronously invokes the 'GetUser' operation.
  437. /// </summary>
  438. /// <param name="callback">Callback to invoke on completion.</param>
  439. /// <param name="asyncState">Optional state object.</param>
  440. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  441. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationDomainService/GetUserDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  442. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationDomainService/GetUser", ReplyAction="http://tempuri.org/AuthenticationDomainService/GetUserResponse")]
  443. [WebGet()]
  444. IAsyncResult BeginGetUser(AsyncCallback callback, object asyncState);
  445. /// <summary>
  446. /// Completes the asynchronous operation begun by 'BeginGetUser'.
  447. /// </summary>
  448. /// <param name="result">The IAsyncResult returned from 'BeginGetUser'.</param>
  449. /// <returns>The 'QueryResult' returned from the 'GetUser' operation.</returns>
  450. QueryResult<AuthUser> EndGetUser(IAsyncResult result);
  451. /// <summary>
  452. /// Asynchronously invokes the 'Login' operation.
  453. /// </summary>
  454. /// <param name="userName">The value for the 'userName' parameter of this action.</param>
  455. /// <param name="password">The value for the 'password' parameter of this action.</param>
  456. /// <param name="isPersistent">The value for the 'isPersistent' parameter of this action.</param>
  457. /// <param name="customData">The value for the 'customData' parameter of this action.</param>
  458. /// <param name="callback">Callback to invoke on completion.</param>
  459. /// <param name="asyncState">Optional state object.</param>
  460. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  461. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationDomainService/LoginDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  462. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationDomainService/Login", ReplyAction="http://tempuri.org/AuthenticationDomainService/LoginResponse")]
  463. IAsyncResult BeginLogin(string userName, string password, bool isPersistent, string customData, AsyncCallback callback, object asyncState);
  464. /// <summary>
  465. /// Completes the asynchronous operation begun by 'BeginLogin'.
  466. /// </summary>
  467. /// <param name="result">The IAsyncResult returned from 'BeginLogin'.</param>
  468. /// <returns>The 'QueryResult' returned from the 'Login' operation.</returns>
  469. QueryResult<AuthUser> EndLogin(IAsyncResult result);
  470. /// <summary>
  471. /// Asynchronously invokes the 'Logout' operation.
  472. /// </summary>
  473. /// <param name="callback">Callback to invoke on completion.</param>
  474. /// <param name="asyncState">Optional state object.</param>
  475. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  476. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationDomainService/LogoutDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  477. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationDomainService/Logout", ReplyAction="http://tempuri.org/AuthenticationDomainService/LogoutResponse")]
  478. IAsyncResult BeginLogout(AsyncCallback callback, object asyncState);
  479. /// <summary>
  480. /// Completes the asynchronous operation begun by 'BeginLogout'.
  481. /// </summary>
  482. /// <param name="result">The IAsyncResult returned from 'BeginLogout'.</param>
  483. /// <returns>The 'QueryResult' returned from the 'Logout' operation.</returns>
  484. QueryResult<AuthUser> EndLogout(IAsyncResult result);
  485. /// <summary>
  486. /// Asynchronously invokes the 'SubmitChanges' operation.
  487. /// </summary>
  488. /// <param name="changeSet">The change-set to submit.</param>
  489. /// <param name="callback">Callback to invoke on completion.</param>
  490. /// <param name="asyncState">Optional state object.</param>
  491. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  492. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationDomainService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  493. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationDomainService/SubmitChanges", ReplyAction="http://tempuri.org/AuthenticationDomainService/SubmitChangesResponse")]
  494. IAsyncResult BeginSubmitChanges(IEnumerable<ChangeSetEntry> changeSet, AsyncCallback callback, object asyncState);
  495. /// <summary>
  496. /// Completes the asynchronous operation begun by 'BeginSubmitChanges'.
  497. /// </summary>
  498. /// <param name="result">The IAsyncResult returned from 'BeginSubmitChanges'.</param>
  499. /// <returns>The collection of change-set entry elements returned from 'SubmitChanges'.</returns>
  500. IEnumerable<ChangeSetEntry> EndSubmitChanges(IAsyncResult result);
  501. }
  502. internal sealed class AuthenticationDomainContextEntityContainer : EntityContainer
  503. {
  504. public AuthenticationDomainContextEntityContainer()
  505. {
  506. this.CreateEntitySet<AuthUser>(EntitySetOperations.Edit);
  507. }
  508. }
  509. }
  510. /// <summary>
  511. /// The 'AuthUser' entity class.
  512. /// </summary>
  513. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  514. public sealed partial class AuthUser : Entity, global::System.Security.Principal.IIdentity, global::System.Security.Principal.IPrincipal
  515. {
  516. private string _name = string.Empty;
  517. private IEnumerable<string> _roles;
  518. #region Extensibility Method Definitions
  519. /// <summary>
  520. /// This method is invoked from the constructor once initialization is complete and
  521. /// can be used for further object setup.
  522. /// </summary>
  523. partial void OnCreated();
  524. partial void OnNameChanging(string value);
  525. partial void OnNameChanged();
  526. partial void OnRolesChanging(IEnumerable<string> value);
  527. partial void OnRolesChanged();
  528. #endregion
  529. /// <summary>
  530. /// Initializes a new instance of the <see cref="AuthUser"/> class.
  531. /// </summary>
  532. public AuthUser()
  533. {
  534. this.OnCreated();
  535. }
  536. /// <summary>
  537. /// Gets or sets the 'Name' value.
  538. /// </summary>
  539. [DataMember()]
  540. [Editable(false, AllowInitialValue=true)]
  541. [Key()]
  542. [RoundtripOriginal()]
  543. public string Name
  544. {
  545. get
  546. {
  547. return this._name;
  548. }
  549. set
  550. {
  551. if ((this._name != value))
  552. {
  553. this.OnNameChanging(value);
  554. this.ValidateProperty("Name", value);
  555. this._name = value;
  556. this.RaisePropertyChanged("Name");
  557. this.OnNameChanged();
  558. this.RaisePropertyChanged("IsAuthenticated");
  559. }
  560. }
  561. }
  562. /// <summary>
  563. /// Gets or sets the 'Roles' value.
  564. /// </summary>
  565. [DataMember()]
  566. [Editable(false)]
  567. public IEnumerable<string> Roles
  568. {
  569. get
  570. {
  571. return this._roles;
  572. }
  573. set
  574. {
  575. if ((this._roles != value))
  576. {
  577. this.OnRolesChanging(value);
  578. this.ValidateProperty("Roles", value);
  579. this._roles = value;
  580. this.RaisePropertyChanged("Roles");
  581. this.OnRolesChanged();
  582. }
  583. }
  584. }
  585. string global::System.Security.Principal.IIdentity.AuthenticationType
  586. {
  587. get
  588. {
  589. return string.Empty;
  590. }
  591. }
  592. /// <summary>
  593. /// Gets a value indicating whether the identity is authenticated.
  594. /// </summary>
  595. /// <remarks>
  596. /// This value is <c>true</c> if <see cref="Name"/> is not <c>null</c> or empty.
  597. /// </remarks>
  598. public bool IsAuthenticated
  599. {
  600. get
  601. {
  602. return (true != string.IsNullOrEmpty(this.Name));
  603. }
  604. }
  605. string global::System.Security.Principal.IIdentity.Name
  606. {
  607. get
  608. {
  609. return this.Name;
  610. }
  611. }
  612. global::System.Security.Principal.IIdentity global::System.Security.Principal.IPrincipal.Identity
  613. {
  614. get
  615. {
  616. return this;
  617. }
  618. }
  619. /// <summary>
  620. /// Computes a value from the key fields that uniquely identifies this entity instance.
  621. /// </summary>
  622. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  623. public override object GetIdentity()
  624. {
  625. return this._name;
  626. }
  627. /// <summary>
  628. /// Return whether the principal is in the role.
  629. /// </summary>
  630. /// <remarks>
  631. /// Returns whether the specified role is contained in the roles.
  632. /// This implementation is case sensitive.
  633. /// </remarks>
  634. /// <param name="role">The name of the role for which to check membership.</param>
  635. /// <returns>Whether the principal is in the role.</returns>
  636. public bool IsInRole(string role)
  637. {
  638. if ((this.Roles == null))
  639. {
  640. return false;
  641. }
  642. return global::System.Linq.Enumerable.Contains(this.Roles, role);
  643. }
  644. }
  645. /// <summary>
  646. /// The 'Course' entity class.
  647. /// </summary>
  648. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  649. public sealed partial class Course : Entity
  650. {
  651. private int _id;
  652. private string _name;
  653. private EntityCollection<Participation> _participation;
  654. #region Extensibility Method Definitions
  655. /// <summary>
  656. /// This method is invoked from the constructor once initialization is complete and
  657. /// can be used for further object setup.
  658. /// </summary>
  659. partial void OnCreated();
  660. partial void OnIdChanging(int value);
  661. partial void OnIdChanged();
  662. partial void OnNameChanging(string value);
  663. partial void OnNameChanged();
  664. #endregion
  665. /// <summary>
  666. /// Initializes a new instance of the <see cref="Course"/> class.
  667. /// </summary>
  668. public Course()
  669. {
  670. this.OnCreated();
  671. }
  672. /// <summary>
  673. /// Gets or sets the 'Id' value.
  674. /// </summary>
  675. [DataMember()]
  676. [Editable(false, AllowInitialValue=true)]
  677. [Key()]
  678. [RoundtripOriginal()]
  679. public int Id
  680. {
  681. get
  682. {
  683. return this._id;
  684. }
  685. set
  686. {
  687. if ((this._id != value))
  688. {
  689. this.OnIdChanging(value);
  690. this.ValidateProperty("Id", value);
  691. this._id = value;
  692. this.RaisePropertyChanged("Id");
  693. this.OnIdChanged();
  694. }
  695. }
  696. }
  697. /// <summary>
  698. /// Gets or sets the 'Name' value.
  699. /// </summary>
  700. [DataMember()]
  701. [Required()]
  702. public string Name
  703. {
  704. get
  705. {
  706. return this._name;
  707. }
  708. set
  709. {
  710. if ((this._name != value))
  711. {
  712. this.OnNameChanging(value);
  713. this.RaiseDataMemberChanging("Name");
  714. this.ValidateProperty("Name", value);
  715. this._name = value;
  716. this.RaiseDataMemberChanged("Name");
  717. this.OnNameChanged();
  718. }
  719. }
  720. }
  721. /// <summary>
  722. /// Gets the collection of associated <see cref="Participation"/> entities.
  723. /// </summary>
  724. [Association("Course_Participation", "Id", "CourseId")]
  725. [XmlIgnore()]
  726. public EntityCollection<Participation> Participation
  727. {
  728. get
  729. {
  730. if ((this._participation == null))
  731. {
  732. this._participation = new EntityCollection<Participation>(this, "Participation", this.FilterParticipation, this.AttachParticipation, this.DetachParticipation);
  733. }
  734. return this._participation;
  735. }
  736. }
  737. private void AttachParticipation(Participation entity)
  738. {
  739. entity.Course = this;
  740. }
  741. private void DetachParticipation(Participation entity)
  742. {
  743. entity.Course = null;
  744. }
  745. private bool FilterParticipation(Participation entity)
  746. {
  747. return (entity.CourseId == this.Id);
  748. }
  749. /// <summary>
  750. /// Computes a value from the key fields that uniquely identifies this entity instance.
  751. /// </summary>
  752. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  753. public override object GetIdentity()
  754. {
  755. return this._id;
  756. }
  757. }
  758. /// <summary>
  759. /// The 'Group' entity class.
  760. /// </summary>
  761. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  762. public sealed partial class Group : Entity
  763. {
  764. private int _id;
  765. private EntityCollection<Membership> _membership;
  766. private string _name;
  767. #region Extensibility Method Definitions
  768. /// <summary>
  769. /// This method is invoked from the constructor once initialization is complete and
  770. /// can be used for further object setup.
  771. /// </summary>
  772. partial void OnCreated();
  773. partial void OnIdChanging(int value);
  774. partial void OnIdChanged();
  775. partial void OnNameChanging(string value);
  776. partial void OnNameChanged();
  777. #endregion
  778. /// <summary>
  779. /// Initializes a new instance of the <see cref="Group"/> class.
  780. /// </summary>
  781. public Group()
  782. {
  783. this.OnCreated();
  784. }
  785. /// <summary>
  786. /// Gets or sets the 'Id' value.
  787. /// </summary>
  788. [DataMember()]
  789. [Editable(false, AllowInitialValue=true)]
  790. [Key()]
  791. [RoundtripOriginal()]
  792. public int Id
  793. {
  794. get
  795. {
  796. return this._id;
  797. }
  798. set
  799. {
  800. if ((this._id != value))
  801. {
  802. this.OnIdChanging(value);
  803. this.ValidateProperty("Id", value);
  804. this._id = value;
  805. this.RaisePropertyChanged("Id");
  806. this.OnIdChanged();
  807. }
  808. }
  809. }
  810. /// <summary>
  811. /// Gets the collection of associated <see cref="Membership"/> entities.
  812. /// </summary>
  813. [Association("Group_Membership", "Id", "GroupId")]
  814. [XmlIgnore()]
  815. public EntityCollection<Membership> Membership
  816. {
  817. get
  818. {
  819. if ((this._membership == null))
  820. {
  821. this._membership = new EntityCollection<Membership>(this, "Membership", this.FilterMembership, this.AttachMembership, this.DetachMembership);
  822. }
  823. return this._membership;
  824. }
  825. }
  826. /// <summary>
  827. /// Gets or sets the 'Name' value.
  828. /// </summary>
  829. [DataMember()]
  830. [Required()]
  831. public string Name
  832. {
  833. get
  834. {
  835. return this._name;
  836. }
  837. set
  838. {
  839. if ((this._name != value))
  840. {
  841. this.OnNameChanging(value);
  842. this.RaiseDataMemberChanging("Name");
  843. this.ValidateProperty("Name", value);
  844. this._name = value;
  845. this.RaiseDataMemberChanged("Name");
  846. this.OnNameChanged();
  847. }
  848. }
  849. }
  850. private void AttachMembership(Membership entity)
  851. {
  852. entity.Group = this;
  853. }
  854. private void DetachMembership(Membership entity)
  855. {
  856. entity.Group = null;
  857. }
  858. private bool FilterMembership(Membership entity)
  859. {
  860. return (entity.GroupId == this.Id);
  861. }
  862. /// <summary>
  863. /// Computes a value from the key fields that uniquely identifies this entity instance.
  864. /// </summary>
  865. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  866. public override object GetIdentity()
  867. {
  868. return this._id;
  869. }
  870. }
  871. /// <summary>
  872. /// The 'Membership' entity class.
  873. /// </summary>
  874. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  875. public sealed partial class Membership : Entity
  876. {
  877. private EntityRef<Group> _group;
  878. private int _groupId;
  879. private int _id;
  880. private EntityRef<User> _user;
  881. private int _userId;
  882. #region Extensibility Method Definitions
  883. /// <summary>
  884. /// This method is invoked from the constructor once initialization is complete and
  885. /// can be used for further object setup.
  886. /// </summary>
  887. partial void OnCreated();
  888. partial void OnGroupIdChanging(int value);
  889. partial void OnGroupIdChanged();
  890. partial void OnIdChanging(int value);
  891. partial void OnIdChanged();
  892. partial void OnUserIdChanging(int value);
  893. partial void OnUserIdChanged();
  894. #endregion
  895. /// <summary>
  896. /// Initializes a new instance of the <see cref="Membership"/> class.
  897. /// </summary>
  898. public Membership()
  899. {
  900. this.OnCreated();
  901. }
  902. /// <summary>
  903. /// Gets or sets the associated <see cref="Group"/> entity.
  904. /// </summary>
  905. [Association("Group_Membership", "GroupId", "Id", IsForeignKey=true)]
  906. [XmlIgnore()]
  907. public Group Group
  908. {
  909. get
  910. {
  911. if ((this._group == null))
  912. {
  913. this._group = new EntityRef<Group>(this, "Group", this.FilterGroup);
  914. }
  915. return this._group.Entity;
  916. }
  917. set
  918. {
  919. Group previous = this.Group;
  920. if ((previous != value))
  921. {
  922. this.ValidateProperty("Group", value);
  923. if ((previous != null))
  924. {
  925. this._group.Entity = null;
  926. previous.Membership.Remove(this);
  927. }
  928. if ((value != null))
  929. {
  930. this.GroupId = value.Id;
  931. }
  932. else
  933. {
  934. this.GroupId = default(int);
  935. }
  936. this._group.Entity = value;
  937. if ((value != null))
  938. {
  939. value.Membership.Add(this);
  940. }
  941. this.RaisePropertyChanged("Group");
  942. }
  943. }
  944. }
  945. /// <summary>
  946. /// Gets or sets the 'GroupId' value.
  947. /// </summary>
  948. [DataMember()]
  949. [RoundtripOriginal()]
  950. public int GroupId
  951. {
  952. get
  953. {
  954. return this._groupId;
  955. }
  956. set
  957. {
  958. if ((this._groupId != value))
  959. {
  960. this.OnGroupIdChanging(value);
  961. this.RaiseDataMemberChanging("GroupId");
  962. this.ValidateProperty("GroupId", value);
  963. this._groupId = value;
  964. this.RaiseDataMemberChanged("GroupId");
  965. this.OnGroupIdChanged();
  966. }
  967. }
  968. }
  969. /// <summary>
  970. /// Gets or sets the 'Id' value.
  971. /// </summary>
  972. [DataMember()]
  973. [Editable(false, AllowInitialValue=true)]
  974. [Key()]
  975. [RoundtripOriginal()]
  976. public int Id
  977. {
  978. get
  979. {
  980. return this._id;
  981. }
  982. set
  983. {
  984. if ((this._id != value))
  985. {
  986. this.OnIdChanging(value);
  987. this.ValidateProperty("Id", value);
  988. this._id = value;
  989. this.RaisePropertyChanged("Id");
  990. this.OnIdChanged();
  991. }
  992. }
  993. }
  994. /// <summary>
  995. /// Gets or sets the associated <see cref="User"/> entity.
  996. /// </summary>
  997. [Association("User_Membership", "UserId", "Id", IsForeignKey=true)]
  998. [XmlIgnore()]
  999. public User User
  1000. {
  1001. get
  1002. {
  1003. if ((this._user == null))
  1004. {
  1005. this._user = new EntityRef<User>(this, "User", this.FilterUser);
  1006. }
  1007. return this._user.Entity;
  1008. }
  1009. set
  1010. {
  1011. User previous = this.User;
  1012. if ((previous != value))
  1013. {
  1014. this.ValidateProperty("User", value);
  1015. if ((previous != null))
  1016. {
  1017. this._user.Entity = null;
  1018. previous.Membership.Remove(this);
  1019. }
  1020. if ((value != null))
  1021. {
  1022. this.UserId = value.Id;
  1023. }
  1024. else
  1025. {
  1026. this.UserId = default(int);
  1027. }
  1028. this._user.Entity = value;
  1029. if ((value != null))
  1030. {
  1031. value.Membership.Add(this);
  1032. }
  1033. this.RaisePropertyChanged("User");
  1034. }
  1035. }
  1036. }
  1037. /// <summary>
  1038. /// Gets or sets the 'UserId' value.
  1039. /// </summary>
  1040. [DataMember()]
  1041. [RoundtripOriginal()]
  1042. public int UserId
  1043. {
  1044. get
  1045. {
  1046. return this._userId;
  1047. }
  1048. set
  1049. {
  1050. if ((this._userId != value))
  1051. {
  1052. this.OnUserIdChanging(value);
  1053. this.RaiseDataMemberChanging("UserId");
  1054. this.ValidateProperty("UserId", value);
  1055. this._userId = value;
  1056. this.RaiseDataMemberChanged("UserId");
  1057. this.OnUserIdChanged();
  1058. }
  1059. }
  1060. }
  1061. private bool FilterGroup(Group entity)
  1062. {
  1063. return (entity.Id == this.GroupId);
  1064. }
  1065. private bool FilterUser(User entity)
  1066. {
  1067. return (entity.Id == this.UserId);
  1068. }
  1069. /// <summary>
  1070. /// Computes a value from the key fields that uniquely identifies this entity instance.
  1071. /// </summary>
  1072. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  1073. public override object GetIdentity()
  1074. {
  1075. return this._id;
  1076. }
  1077. }
  1078. /// <summary>
  1079. /// The 'Participation' entity class.
  1080. /// </summary>
  1081. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/glados.Web")]
  1082. public sealed partial class Participation : Entity
  1083. {
  1084. private EntityCollection<Assignment> _assignment;
  1085. private EntityRef<Course> _course;
  1086. private int _courseId;
  1087. private int _id;
  1088. private EntityRef<User> _user;
  1089. private int _userId;
  1090. #region Extensibility Method Definitions
  1091. /// <summary>
  1092. /// This method is invoked from the constructor once initialization is complete and
  1093. /// can be used for further object setup.
  1094. /// </summary>
  1095. partial void OnCreated();
  1096. partial void OnCourseIdChanging(int value);
  1097. partial void OnCourseIdChanged();
  1098. partial void OnIdChanging(int value);
  1099. partial void OnIdChanged();
  1100. partial void OnUserIdChanging(int value);
  1101. partial void OnUserIdChanged();
  1102. #endregion
  1103. /// <summary>
  1104. /// Initializes a new instance of the <see cref="Participation"/> class.
  1105. /// </summary>
  1106. public Participation()
  1107. {
  1108. this.OnCreated();
  1109. }
  1110. /// <summary>
  1111. /// Gets the collection of associated <see cref="Assignment"/> entities.
  1112. /// </summary>
  1113. [Association("Participation_Assignment", "Id", "ParticipationId")]
  1114. [XmlIgnore()]
  1115. public EntityCollection<Assignment> Assignment
  1116. {
  1117. get
  1118. {
  1119. if ((this._assignment == null))
  1120. {
  1121. this._assignment = new EntityCollection<Assignment>(this, "Assignment", this.FilterAssignment, this.AttachAssignment, this.DetachAssignment);
  1122. }
  1123. return this._assignment;
  1124. }
  1125. }
  1126. /// <summary>
  1127. /// Gets or sets the associated <see cref="Course"/> entity.
  1128. /// </summary>
  1129. [Association("Course_Participation", "CourseId", "Id", IsForeignKey=true)]
  1130. [XmlIgnore()]
  1131. public Course Course
  1132. {
  1133. get
  1134. {
  1135. if ((this._course == null))
  1136. {
  1137. this._course = new EntityRef<Course>(this, "Course", this.FilterCourse);
  1138. }
  1139. return this._course.Entity;
  1140. }
  1141. set
  1142. {
  1143. Course previous = this.Course;
  1144. if ((previous != value))
  1145. {
  1146. this.ValidateProperty("Course", value);
  1147. if ((previous != null))
  1148. {
  1149. this._course.Entity = null;
  1150. previous.Participation.Remove(this);
  1151. }
  1152. if ((value != null))
  1153. {
  1154. this.CourseId = value.Id;
  1155. }
  1156. else
  1157. {
  1158. this.CourseId = default(int);
  1159. }
  1160. this._course.Entity = value;
  1161. if ((value != null))
  1162. {
  1163. value.Participation.Add(this);
  1164. }
  1165. this.RaisePropertyChanged("Course");
  1166. }
  1167. }
  1168. }
  1169. /// <summary>
  1170. /// Gets or sets the 'CourseId' value.
  1171. /// </summary>
  1172. [DataMember()]
  1173. [RoundtripOriginal()]
  1174. public int CourseId
  1175. {
  1176. get
  1177. {
  1178. return this._courseId;
  1179. }
  1180. set
  1181. {
  1182. if ((this._courseId != value))
  1183. {
  1184. this.OnCourseIdChanging(value);
  1185. this.RaiseDataMemberChanging("CourseId");
  1186. this.ValidateProperty("CourseId", value);
  1187. this._courseId = value;
  1188. this.RaiseDataMemberChanged("CourseId");
  1189. this.OnCourseIdChanged();
  1190. }
  1191. }
  1192. }
  1193. /// <summary>
  1194. /// Gets or sets the 'Id' value.
  1195. /// </summary>
  1196. [DataMember()]
  1197. [Editable(false, AllowInitialValue=true)]
  1198. [Key()]
  1199. [RoundtripOriginal()]
  1200. public int Id
  1201. {
  1202. get
  1203. {
  1204. return this._id;
  1205. }
  1206. set
  1207. {
  1208. if ((this._id != value))
  1209. {
  1210. this.OnIdChanging(value);
  1211. this.ValidateProperty("Id", value);
  1212. this._id = value;
  1213. this.RaisePropertyChanged("Id");
  1214. this.OnIdChanged();
  1215. }
  1216. }
  1217. }
  1218. /// <summary>
  1219. /// Gets or sets the associated <see cref="User"/> entity.
  1220. /// </summary>
  1221. [Association("User_Participation", "UserId", "Id", IsForeignKey=true)]
  1222. [XmlIgnore()]
  1223. public User User
  1224. {
  1225. get
  1226. {
  1227. if ((this._user == null))
  1228. {
  1229. this._user = new EntityRef<User>(this, "User", this.FilterUser);
  1230. }
  1231. return this._user.Entity;
  1232. }
  1233. set
  1234. {
  1235. User previous = this.User;
  1236. if ((previous != value))
  1237. {
  1238. this.ValidateProperty("User", value);
  1239. if ((previous != null))
  1240. {
  1241. this._user.Entity = null;
  1242. previous.Participation.Remove(this);
  1243. }
  1244. if ((value != null))
  1245. {
  1246. this.UserId = value.Id;
  1247. }
  1248. else
  1249. {
  1250. this.UserId = default(int);
  1251. }
  1252. this._user.Entity = value;
  1253. if ((value != null))
  1254. {
  1255. value.Participation.Add(this);
  1256. }
  1257. this.RaisePropertyChanged("User");
  1258. }
  1259. }
  1260. }
  1261. /// <summary>
  1262. /// Gets or sets the 'UserId' value.
  1263. /// </summary>
  1264. [DataMember()]
  1265. [RoundtripOriginal()]
  1266. public int UserId
  1267. {
  1268. get
  1269. {
  1270. return this._userId;
  1271. }
  1272. set
  1273. {
  1274. if ((this._userId != value))
  1275. {
  1276. this.OnUserIdChanging(value);

Large files files are truncated, but you can click here to view the full file