PageRenderTime 43ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/TailspinTravel-Ria/code/End/MSTravel/MSTravel/Generated_Code/MSTravel.Web.g.cs

#
C# | 1618 lines | 1038 code | 177 blank | 403 comment | 75 complexity | e65771caf03e174776cf8f72be3de6bf MD5 | raw file
Possible License(s): CC-BY-SA-3.0

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

  1. // ----------------------------------------------------------------------------------
  2. // Microsoft Developer & Platform Evangelism
  3. //
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
  7. // EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  8. // OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  9. // ----------------------------------------------------------------------------------
  10. // The example companies, organizations, products, domain names,
  11. // e-mail addresses, logos, people, places, and events depicted
  12. // herein are fictitious. No association with any real company,
  13. // organization, product, domain name, email address, logo, person,
  14. // places, or events is intended or should be inferred.
  15. // ----------------------------------------------------------------------------------
  16. //------------------------------------------------------------------------------
  17. // <auto-generated>
  18. // This code was generated by a tool.
  19. // Runtime Version:4.0.30319.1
  20. //
  21. // Changes to this file may cause incorrect behavior and will be lost if
  22. // the code is regenerated.
  23. // </auto-generated>
  24. //------------------------------------------------------------------------------
  25. namespace Microsoft.Samples.MSTravel
  26. {
  27. using System;
  28. using System.Collections.Generic;
  29. using System.ComponentModel;
  30. using System.ComponentModel.DataAnnotations;
  31. using System.Linq;
  32. using System.ServiceModel.DomainServices;
  33. using System.ServiceModel.DomainServices.Client;
  34. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  35. using Microsoft.Samples.MSTravel.Web;
  36. /// <summary>
  37. /// Context for the RIA application.
  38. /// </summary>
  39. /// <remarks>
  40. /// This context extends the base to make application services and types available
  41. /// for consumption from code and xaml.
  42. /// </remarks>
  43. public sealed partial class WebContext : WebContextBase
  44. {
  45. #region Extensibility Method Definitions
  46. /// <summary>
  47. /// This method is invoked from the constructor once initialization is complete and
  48. /// can be used for further object setup.
  49. /// </summary>
  50. partial void OnCreated();
  51. #endregion
  52. /// <summary>
  53. /// Initializes a new instance of the WebContext class.
  54. /// </summary>
  55. public WebContext()
  56. {
  57. this.OnCreated();
  58. }
  59. /// <summary>
  60. /// Gets the context that is registered as a lifetime object with the current application.
  61. /// </summary>
  62. /// <exception cref="InvalidOperationException"> is thrown if there is no current application,
  63. /// no contexts have been added, or more than one context has been added.
  64. /// </exception>
  65. /// <seealso cref="System.Windows.Application.ApplicationLifetimeObjects"/>
  66. public new static WebContext Current
  67. {
  68. get
  69. {
  70. return ((WebContext)(WebContextBase.Current));
  71. }
  72. }
  73. /// <summary>
  74. /// Gets a user representing the authenticated identity.
  75. /// </summary>
  76. public new User User
  77. {
  78. get
  79. {
  80. return ((User)(base.User));
  81. }
  82. }
  83. }
  84. }
  85. namespace Microsoft.Samples.MSTravel.Web
  86. {
  87. using System;
  88. using System.Collections.Generic;
  89. using System.ComponentModel;
  90. using System.ComponentModel.DataAnnotations;
  91. using System.Linq;
  92. using System.Runtime.Serialization;
  93. using System.ServiceModel;
  94. using System.ServiceModel.DomainServices;
  95. using System.ServiceModel.DomainServices.Client;
  96. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  97. using System.ServiceModel.Web;
  98. using Microsoft.Samples.MSTravel.Web.Resources;
  99. /// <summary>
  100. /// The domain context corresponding to the 'AuthenticationService' domain service.
  101. /// </summary>
  102. public sealed partial class AuthenticationContext : global::System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationDomainContextBase
  103. {
  104. #region Extensibility Method Definitions
  105. /// <summary>
  106. /// This method is invoked from the constructor once initialization is complete and
  107. /// can be used for further object setup.
  108. /// </summary>
  109. partial void OnCreated();
  110. #endregion
  111. /// <summary>
  112. /// Initializes a new instance of the <see cref="AuthenticationContext"/> class.
  113. /// </summary>
  114. public AuthenticationContext() :
  115. this(new WebDomainClient<IAuthenticationServiceContract>(new Uri("Microsoft-Samples-MSTravel-Web-AuthenticationService.svc", UriKind.Relative)))
  116. {
  117. }
  118. /// <summary>
  119. /// Initializes a new instance of the <see cref="AuthenticationContext"/> class with the specified service URI.
  120. /// </summary>
  121. /// <param name="serviceUri">The AuthenticationService service URI.</param>
  122. public AuthenticationContext(Uri serviceUri) :
  123. this(new WebDomainClient<IAuthenticationServiceContract>(serviceUri))
  124. {
  125. }
  126. /// <summary>
  127. /// Initializes a new instance of the <see cref="AuthenticationContext"/> class with the specified <paramref name="domainClient"/>.
  128. /// </summary>
  129. /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
  130. public AuthenticationContext(DomainClient domainClient) :
  131. base(domainClient)
  132. {
  133. this.OnCreated();
  134. }
  135. /// <summary>
  136. /// Gets the set of <see cref="User"/> entities that have been loaded into this <see cref="AuthenticationContext"/> instance.
  137. /// </summary>
  138. public EntitySet<User> Users
  139. {
  140. get
  141. {
  142. return base.EntityContainer.GetEntitySet<User>();
  143. }
  144. }
  145. /// <summary>
  146. /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'GetUser' query.
  147. /// </summary>
  148. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
  149. public EntityQuery<User> GetUserQuery()
  150. {
  151. this.ValidateMethod("GetUserQuery", null);
  152. return base.CreateQuery<User>("GetUser", null, false, false);
  153. }
  154. /// <summary>
  155. /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'Login' query.
  156. /// </summary>
  157. /// <param name="userName">The value for the 'userName' parameter of the query.</param>
  158. /// <param name="password">The value for the 'password' parameter of the query.</param>
  159. /// <param name="isPersistent">The value for the 'isPersistent' parameter of the query.</param>
  160. /// <param name="customData">The value for the 'customData' parameter of the query.</param>
  161. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
  162. public EntityQuery<User> LoginQuery(string userName, string password, bool isPersistent, string customData)
  163. {
  164. Dictionary<string, object> parameters = new Dictionary<string, object>();
  165. parameters.Add("userName", userName);
  166. parameters.Add("password", password);
  167. parameters.Add("isPersistent", isPersistent);
  168. parameters.Add("customData", customData);
  169. this.ValidateMethod("LoginQuery", parameters);
  170. return base.CreateQuery<User>("Login", parameters, true, false);
  171. }
  172. /// <summary>
  173. /// Gets an EntityQuery instance that can be used to load <see cref="User"/> entities using the 'Logout' query.
  174. /// </summary>
  175. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="User"/> entities.</returns>
  176. public EntityQuery<User> LogoutQuery()
  177. {
  178. this.ValidateMethod("LogoutQuery", null);
  179. return base.CreateQuery<User>("Logout", null, true, false);
  180. }
  181. /// <summary>
  182. /// Creates a new entity container for this domain context's entity sets.
  183. /// </summary>
  184. /// <returns>A new container instance.</returns>
  185. protected override EntityContainer CreateEntityContainer()
  186. {
  187. return new AuthenticationContextEntityContainer();
  188. }
  189. /// <summary>
  190. /// Service contract for the 'AuthenticationService' domain service.
  191. /// </summary>
  192. [ServiceContract()]
  193. public interface IAuthenticationServiceContract
  194. {
  195. /// <summary>
  196. /// Asynchronously invokes the 'GetUser' operation.
  197. /// </summary>
  198. /// <param name="callback">Callback to invoke on completion.</param>
  199. /// <param name="asyncState">Optional state object.</param>
  200. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  201. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationService/GetUserDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  202. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/GetUser", ReplyAction="http://tempuri.org/AuthenticationService/GetUserResponse")]
  203. [WebGet()]
  204. IAsyncResult BeginGetUser(AsyncCallback callback, object asyncState);
  205. /// <summary>
  206. /// Completes the asynchronous operation begun by 'BeginGetUser'.
  207. /// </summary>
  208. /// <param name="result">The IAsyncResult returned from 'BeginGetUser'.</param>
  209. /// <returns>The 'QueryResult' returned from the 'GetUser' operation.</returns>
  210. QueryResult<User> EndGetUser(IAsyncResult result);
  211. /// <summary>
  212. /// Asynchronously invokes the 'Login' operation.
  213. /// </summary>
  214. /// <param name="userName">The value for the 'userName' parameter of this action.</param>
  215. /// <param name="password">The value for the 'password' parameter of this action.</param>
  216. /// <param name="isPersistent">The value for the 'isPersistent' parameter of this action.</param>
  217. /// <param name="customData">The value for the 'customData' parameter of this action.</param>
  218. /// <param name="callback">Callback to invoke on completion.</param>
  219. /// <param name="asyncState">Optional state object.</param>
  220. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  221. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationService/LoginDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  222. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/Login", ReplyAction="http://tempuri.org/AuthenticationService/LoginResponse")]
  223. IAsyncResult BeginLogin(string userName, string password, bool isPersistent, string customData, AsyncCallback callback, object asyncState);
  224. /// <summary>
  225. /// Completes the asynchronous operation begun by 'BeginLogin'.
  226. /// </summary>
  227. /// <param name="result">The IAsyncResult returned from 'BeginLogin'.</param>
  228. /// <returns>The 'QueryResult' returned from the 'Login' operation.</returns>
  229. QueryResult<User> EndLogin(IAsyncResult result);
  230. /// <summary>
  231. /// Asynchronously invokes the 'Logout' operation.
  232. /// </summary>
  233. /// <param name="callback">Callback to invoke on completion.</param>
  234. /// <param name="asyncState">Optional state object.</param>
  235. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  236. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationService/LogoutDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  237. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/Logout", ReplyAction="http://tempuri.org/AuthenticationService/LogoutResponse")]
  238. IAsyncResult BeginLogout(AsyncCallback callback, object asyncState);
  239. /// <summary>
  240. /// Completes the asynchronous operation begun by 'BeginLogout'.
  241. /// </summary>
  242. /// <param name="result">The IAsyncResult returned from 'BeginLogout'.</param>
  243. /// <returns>The 'QueryResult' returned from the 'Logout' operation.</returns>
  244. QueryResult<User> EndLogout(IAsyncResult result);
  245. /// <summary>
  246. /// Asynchronously invokes the 'SubmitChanges' operation.
  247. /// </summary>
  248. /// <param name="changeSet">The change-set to submit.</param>
  249. /// <param name="callback">Callback to invoke on completion.</param>
  250. /// <param name="asyncState">Optional state object.</param>
  251. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  252. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/AuthenticationService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  253. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/AuthenticationService/SubmitChanges", ReplyAction="http://tempuri.org/AuthenticationService/SubmitChangesResponse")]
  254. IAsyncResult BeginSubmitChanges(IEnumerable<ChangeSetEntry> changeSet, AsyncCallback callback, object asyncState);
  255. /// <summary>
  256. /// Completes the asynchronous operation begun by 'BeginSubmitChanges'.
  257. /// </summary>
  258. /// <param name="result">The IAsyncResult returned from 'BeginSubmitChanges'.</param>
  259. /// <returns>The collection of change-set entry elements returned from 'SubmitChanges'.</returns>
  260. IEnumerable<ChangeSetEntry> EndSubmitChanges(IAsyncResult result);
  261. }
  262. internal sealed class AuthenticationContextEntityContainer : EntityContainer
  263. {
  264. public AuthenticationContextEntityContainer()
  265. {
  266. this.CreateEntitySet<User>(EntitySetOperations.Edit);
  267. }
  268. }
  269. }
  270. public enum CreateUserStatus
  271. {
  272. Success = 0,
  273. InvalidUserName = 1,
  274. InvalidPassword = 2,
  275. InvalidQuestion = 3,
  276. InvalidAnswer = 4,
  277. InvalidEmail = 5,
  278. DuplicateUserName = 6,
  279. DuplicateEmail = 7,
  280. Failure = 8,
  281. }
  282. /// <summary>
  283. /// The 'RegistrationData' entity class.
  284. /// </summary>
  285. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Samples.MSTravel.Web")]
  286. public sealed partial class RegistrationData : Entity
  287. {
  288. private string _answer;
  289. private string _email;
  290. private string _friendlyName;
  291. private string _question;
  292. private string _userName;
  293. #region Extensibility Method Definitions
  294. /// <summary>
  295. /// This method is invoked from the constructor once initialization is complete and
  296. /// can be used for further object setup.
  297. /// </summary>
  298. partial void OnCreated();
  299. partial void OnAnswerChanging(string value);
  300. partial void OnAnswerChanged();
  301. partial void OnEmailChanging(string value);
  302. partial void OnEmailChanged();
  303. partial void OnFriendlyNameChanging(string value);
  304. partial void OnFriendlyNameChanged();
  305. partial void OnQuestionChanging(string value);
  306. partial void OnQuestionChanged();
  307. partial void OnUserNameChanging(string value);
  308. partial void OnUserNameChanged();
  309. #endregion
  310. /// <summary>
  311. /// Initializes a new instance of the <see cref="RegistrationData"/> class.
  312. /// </summary>
  313. public RegistrationData()
  314. {
  315. this.OnCreated();
  316. }
  317. /// <summary>
  318. /// Gets or sets the 'Answer' value.
  319. /// </summary>
  320. [DataMember()]
  321. [Display(Name="SecurityAnswerLabel", Order=6, ResourceType=typeof(RegistrationDataResources))]
  322. [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  323. public string Answer
  324. {
  325. get
  326. {
  327. return this._answer;
  328. }
  329. set
  330. {
  331. if ((this._answer != value))
  332. {
  333. this.OnAnswerChanging(value);
  334. this.RaiseDataMemberChanging("Answer");
  335. this.ValidateProperty("Answer", value);
  336. this._answer = value;
  337. this.RaiseDataMemberChanged("Answer");
  338. this.OnAnswerChanged();
  339. }
  340. }
  341. }
  342. /// <summary>
  343. /// Gets or sets the 'Email' value.
  344. /// </summary>
  345. [DataMember()]
  346. [Display(Name="EmailLabel", Order=2, ResourceType=typeof(RegistrationDataResources))]
  347. [Editable(false, AllowInitialValue=true)]
  348. [Key()]
  349. [RegularExpression("^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4" +
  350. "}|[0-9]{1,3})(\\]?)$", ErrorMessageResourceName="ValidationErrorInvalidEmail", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  351. [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  352. [RoundtripOriginal()]
  353. public string Email
  354. {
  355. get
  356. {
  357. return this._email;
  358. }
  359. set
  360. {
  361. if ((this._email != value))
  362. {
  363. this.OnEmailChanging(value);
  364. this.ValidateProperty("Email", value);
  365. this._email = value;
  366. this.RaisePropertyChanged("Email");
  367. this.OnEmailChanged();
  368. }
  369. }
  370. }
  371. /// <summary>
  372. /// Gets or sets the 'FriendlyName' value.
  373. /// </summary>
  374. [DataMember()]
  375. [Display(Description="FriendlyNameDescription", Name="FriendlyNameLabel", Order=1, ResourceType=typeof(RegistrationDataResources))]
  376. [StringLength(255, ErrorMessageResourceName="ValidationErrorBadFriendlyNameLength", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  377. public string FriendlyName
  378. {
  379. get
  380. {
  381. return this._friendlyName;
  382. }
  383. set
  384. {
  385. if ((this._friendlyName != value))
  386. {
  387. this.OnFriendlyNameChanging(value);
  388. this.RaiseDataMemberChanging("FriendlyName");
  389. this.ValidateProperty("FriendlyName", value);
  390. this._friendlyName = value;
  391. this.RaiseDataMemberChanged("FriendlyName");
  392. this.OnFriendlyNameChanged();
  393. }
  394. }
  395. }
  396. /// <summary>
  397. /// Gets or sets the 'Question' value.
  398. /// </summary>
  399. [DataMember()]
  400. [Display(Name="SecurityQuestionLabel", Order=5, ResourceType=typeof(RegistrationDataResources))]
  401. [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  402. public string Question
  403. {
  404. get
  405. {
  406. return this._question;
  407. }
  408. set
  409. {
  410. if ((this._question != value))
  411. {
  412. this.OnQuestionChanging(value);
  413. this.RaiseDataMemberChanging("Question");
  414. this.ValidateProperty("Question", value);
  415. this._question = value;
  416. this.RaiseDataMemberChanged("Question");
  417. this.OnQuestionChanged();
  418. }
  419. }
  420. }
  421. /// <summary>
  422. /// Gets or sets the 'UserName' value.
  423. /// </summary>
  424. [DataMember()]
  425. [Display(Name="UserNameLabel", Order=0, ResourceType=typeof(RegistrationDataResources))]
  426. [Editable(false, AllowInitialValue=true)]
  427. [Key()]
  428. [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessageResourceName="ValidationErrorInvalidUserName", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  429. [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))]
  430. [RoundtripOriginal()]
  431. [StringLength(255, ErrorMessageResourceName="ValidationErrorBadUserNameLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=4)]
  432. public string UserName
  433. {
  434. get
  435. {
  436. return this._userName;
  437. }
  438. set
  439. {
  440. if ((this._userName != value))
  441. {
  442. this.OnUserNameChanging(value);
  443. this.ValidateProperty("UserName", value);
  444. this._userName = value;
  445. this.RaisePropertyChanged("UserName");
  446. this.OnUserNameChanged();
  447. }
  448. }
  449. }
  450. /// <summary>
  451. /// Computes a value from the key fields that uniquely identifies this entity instance.
  452. /// </summary>
  453. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  454. public override object GetIdentity()
  455. {
  456. if (((this._email == null)
  457. || (this._userName == null)))
  458. {
  459. return null;
  460. }
  461. return EntityKey.Create(this._email, this._userName);
  462. }
  463. }
  464. /// <summary>
  465. /// The 'User' entity class.
  466. /// </summary>
  467. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Samples.MSTravel.Web")]
  468. public sealed partial class User : Entity, global::System.Security.Principal.IIdentity, global::System.Security.Principal.IPrincipal
  469. {
  470. private string _friendlyName;
  471. private string _homeAirport;
  472. private string _mileagePlan;
  473. private string _name = string.Empty;
  474. private string _photoURL;
  475. private string _preferredAirline;
  476. private IEnumerable<string> _roles;
  477. #region Extensibility Method Definitions
  478. /// <summary>
  479. /// This method is invoked from the constructor once initialization is complete and
  480. /// can be used for further object setup.
  481. /// </summary>
  482. partial void OnCreated();
  483. partial void OnFriendlyNameChanging(string value);
  484. partial void OnFriendlyNameChanged();
  485. partial void OnHomeAirportChanging(string value);
  486. partial void OnHomeAirportChanged();
  487. partial void OnMileagePlanChanging(string value);
  488. partial void OnMileagePlanChanged();
  489. partial void OnNameChanging(string value);
  490. partial void OnNameChanged();
  491. partial void OnPhotoURLChanging(string value);
  492. partial void OnPhotoURLChanged();
  493. partial void OnPreferredAirlineChanging(string value);
  494. partial void OnPreferredAirlineChanged();
  495. partial void OnRolesChanging(IEnumerable<string> value);
  496. partial void OnRolesChanged();
  497. #endregion
  498. /// <summary>
  499. /// Initializes a new instance of the <see cref="User"/> class.
  500. /// </summary>
  501. public User()
  502. {
  503. this.OnCreated();
  504. }
  505. /// <summary>
  506. /// Gets or sets the 'FriendlyName' value.
  507. /// </summary>
  508. [DataMember()]
  509. public string FriendlyName
  510. {
  511. get
  512. {
  513. return this._friendlyName;
  514. }
  515. set
  516. {
  517. if ((this._friendlyName != value))
  518. {
  519. this.OnFriendlyNameChanging(value);
  520. this.RaiseDataMemberChanging("FriendlyName");
  521. this.ValidateProperty("FriendlyName", value);
  522. this._friendlyName = value;
  523. this.RaiseDataMemberChanged("FriendlyName");
  524. this.OnFriendlyNameChanged();
  525. }
  526. }
  527. }
  528. /// <summary>
  529. /// Gets or sets the 'HomeAirport' value.
  530. /// </summary>
  531. [DataMember()]
  532. public string HomeAirport
  533. {
  534. get
  535. {
  536. return this._homeAirport;
  537. }
  538. set
  539. {
  540. if ((this._homeAirport != value))
  541. {
  542. this.OnHomeAirportChanging(value);
  543. this.RaiseDataMemberChanging("HomeAirport");
  544. this.ValidateProperty("HomeAirport", value);
  545. this._homeAirport = value;
  546. this.RaiseDataMemberChanged("HomeAirport");
  547. this.OnHomeAirportChanged();
  548. }
  549. }
  550. }
  551. /// <summary>
  552. /// Gets or sets the 'MileagePlan' value.
  553. /// </summary>
  554. [DataMember()]
  555. public string MileagePlan
  556. {
  557. get
  558. {
  559. return this._mileagePlan;
  560. }
  561. set
  562. {
  563. if ((this._mileagePlan != value))
  564. {
  565. this.OnMileagePlanChanging(value);
  566. this.RaiseDataMemberChanging("MileagePlan");
  567. this.ValidateProperty("MileagePlan", value);
  568. this._mileagePlan = value;
  569. this.RaiseDataMemberChanged("MileagePlan");
  570. this.OnMileagePlanChanged();
  571. }
  572. }
  573. }
  574. /// <summary>
  575. /// Gets or sets the 'Name' value.
  576. /// </summary>
  577. [DataMember()]
  578. [Editable(false, AllowInitialValue=true)]
  579. [Key()]
  580. [RoundtripOriginal()]
  581. public string Name
  582. {
  583. get
  584. {
  585. return this._name;
  586. }
  587. set
  588. {
  589. if ((this._name != value))
  590. {
  591. this.OnNameChanging(value);
  592. this.ValidateProperty("Name", value);
  593. this._name = value;
  594. this.RaisePropertyChanged("Name");
  595. this.OnNameChanged();
  596. this.RaisePropertyChanged("IsAuthenticated");
  597. }
  598. }
  599. }
  600. /// <summary>
  601. /// Gets or sets the 'PhotoURL' value.
  602. /// </summary>
  603. [DataMember()]
  604. public string PhotoURL
  605. {
  606. get
  607. {
  608. return this._photoURL;
  609. }
  610. set
  611. {
  612. if ((this._photoURL != value))
  613. {
  614. this.OnPhotoURLChanging(value);
  615. this.RaiseDataMemberChanging("PhotoURL");
  616. this.ValidateProperty("PhotoURL", value);
  617. this._photoURL = value;
  618. this.RaiseDataMemberChanged("PhotoURL");
  619. this.OnPhotoURLChanged();
  620. }
  621. }
  622. }
  623. /// <summary>
  624. /// Gets or sets the 'PreferredAirline' value.
  625. /// </summary>
  626. [DataMember()]
  627. public string PreferredAirline
  628. {
  629. get
  630. {
  631. return this._preferredAirline;
  632. }
  633. set
  634. {
  635. if ((this._preferredAirline != value))
  636. {
  637. this.OnPreferredAirlineChanging(value);
  638. this.RaiseDataMemberChanging("PreferredAirline");
  639. this.ValidateProperty("PreferredAirline", value);
  640. this._preferredAirline = value;
  641. this.RaiseDataMemberChanged("PreferredAirline");
  642. this.OnPreferredAirlineChanged();
  643. }
  644. }
  645. }
  646. /// <summary>
  647. /// Gets or sets the 'Roles' value.
  648. /// </summary>
  649. [DataMember()]
  650. [Editable(false)]
  651. public IEnumerable<string> Roles
  652. {
  653. get
  654. {
  655. return this._roles;
  656. }
  657. set
  658. {
  659. if ((this._roles != value))
  660. {
  661. this.OnRolesChanging(value);
  662. this.ValidateProperty("Roles", value);
  663. this._roles = value;
  664. this.RaisePropertyChanged("Roles");
  665. this.OnRolesChanged();
  666. }
  667. }
  668. }
  669. string global::System.Security.Principal.IIdentity.AuthenticationType
  670. {
  671. get
  672. {
  673. return string.Empty;
  674. }
  675. }
  676. /// <summary>
  677. /// Gets a value indicating whether the identity is authenticated.
  678. /// </summary>
  679. /// <remarks>
  680. /// This value is <c>true</c> if <see cref="Name"/> is not <c>null</c> or empty.
  681. /// </remarks>
  682. public bool IsAuthenticated
  683. {
  684. get
  685. {
  686. return (true != string.IsNullOrEmpty(this.Name));
  687. }
  688. }
  689. string global::System.Security.Principal.IIdentity.Name
  690. {
  691. get
  692. {
  693. return this.Name;
  694. }
  695. }
  696. global::System.Security.Principal.IIdentity global::System.Security.Principal.IPrincipal.Identity
  697. {
  698. get
  699. {
  700. return this;
  701. }
  702. }
  703. /// <summary>
  704. /// Computes a value from the key fields that uniquely identifies this entity instance.
  705. /// </summary>
  706. /// <returns>An object instance that uniquely identifies this entity instance.</returns>
  707. public override object GetIdentity()
  708. {
  709. return this._name;
  710. }
  711. /// <summary>
  712. /// Return whether the principal is in the role.
  713. /// </summary>
  714. /// <remarks>
  715. /// Returns whether the specified role is contained in the roles.
  716. /// This implementation is case sensitive.
  717. /// </remarks>
  718. /// <param name="role">The name of the role for which to check membership.</param>
  719. /// <returns>Whether the principal is in the role.</returns>
  720. public bool IsInRole(string role)
  721. {
  722. if ((this.Roles == null))
  723. {
  724. return false;
  725. }
  726. return global::System.Linq.Enumerable.Contains(this.Roles, role);
  727. }
  728. }
  729. /// <summary>
  730. /// The domain context corresponding to the 'UserRegistrationService' domain service.
  731. /// </summary>
  732. public sealed partial class UserRegistrationContext : DomainContext
  733. {
  734. #region Extensibility Method Definitions
  735. /// <summary>
  736. /// This method is invoked from the constructor once initialization is complete and
  737. /// can be used for further object setup.
  738. /// </summary>
  739. partial void OnCreated();
  740. #endregion
  741. /// <summary>
  742. /// Initializes a new instance of the <see cref="UserRegistrationContext"/> class.
  743. /// </summary>
  744. public UserRegistrationContext() :
  745. this(new WebDomainClient<IUserRegistrationServiceContract>(new Uri("Microsoft-Samples-MSTravel-Web-UserRegistrationService.svc", UriKind.Relative)))
  746. {
  747. }
  748. /// <summary>
  749. /// Initializes a new instance of the <see cref="UserRegistrationContext"/> class with the specified service URI.
  750. /// </summary>
  751. /// <param name="serviceUri">The UserRegistrationService service URI.</param>
  752. public UserRegistrationContext(Uri serviceUri) :
  753. this(new WebDomainClient<IUserRegistrationServiceContract>(serviceUri))
  754. {
  755. }
  756. /// <summary>
  757. /// Initializes a new instance of the <see cref="UserRegistrationContext"/> class with the specified <paramref name="domainClient"/>.
  758. /// </summary>
  759. /// <param name="domainClient">The DomainClient instance to use for this domain context.</param>
  760. public UserRegistrationContext(DomainClient domainClient) :
  761. base(domainClient)
  762. {
  763. this.OnCreated();
  764. }
  765. /// <summary>
  766. /// Gets the set of <see cref="RegistrationData"/> entities that have been loaded into this <see cref="UserRegistrationContext"/> instance.
  767. /// </summary>
  768. public EntitySet<RegistrationData> RegistrationDatas
  769. {
  770. get
  771. {
  772. return base.EntityContainer.GetEntitySet<RegistrationData>();
  773. }
  774. }
  775. /// <summary>
  776. /// Gets an EntityQuery instance that can be used to load <see cref="RegistrationData"/> entities using the 'GetUsers' query.
  777. /// </summary>
  778. /// <returns>An EntityQuery that can be loaded to retrieve <see cref="RegistrationData"/> entities.</returns>
  779. public EntityQuery<RegistrationData> GetUsersQuery()
  780. {
  781. this.ValidateMethod("GetUsersQuery", null);
  782. return base.CreateQuery<RegistrationData>("GetUsers", null, false, true);
  783. }
  784. /// <summary>
  785. /// Asynchronously invokes the 'CreateUser' method of the domain service.
  786. /// </summary>
  787. /// <param name="user">The value for the 'user' parameter of this action.</param>
  788. /// <param name="password">The value for the 'password' parameter of this action.</param>
  789. /// <param name="callback">Callback to invoke when the operation completes.</param>
  790. /// <param name="userState">Value to pass to the callback. It can be <c>null</c>.</param>
  791. /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
  792. public InvokeOperation<CreateUserStatus> CreateUser(RegistrationData user, [RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName="ValidationErrorBadPasswordStrength", ErrorMessageResourceType=typeof(ValidationErrorResources))] [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))] [StringLength(50, ErrorMessageResourceName="ValidationErrorBadPasswordLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=7)] string password, Action<InvokeOperation<CreateUserStatus>> callback, object userState)
  793. {
  794. Dictionary<string, object> parameters = new Dictionary<string, object>();
  795. parameters.Add("user", user);
  796. parameters.Add("password", password);
  797. this.ValidateMethod("CreateUser", parameters);
  798. return ((InvokeOperation<CreateUserStatus>)(this.InvokeOperation("CreateUser", typeof(CreateUserStatus), parameters, true, callback, userState)));
  799. }
  800. /// <summary>
  801. /// Asynchronously invokes the 'CreateUser' method of the domain service.
  802. /// </summary>
  803. /// <param name="user">The value for the 'user' parameter of this action.</param>
  804. /// <param name="password">The value for the 'password' parameter of this action.</param>
  805. /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
  806. public InvokeOperation<CreateUserStatus> CreateUser(RegistrationData user, [RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName="ValidationErrorBadPasswordStrength", ErrorMessageResourceType=typeof(ValidationErrorResources))] [Required(ErrorMessageResourceName="ValidationErrorRequiredField", ErrorMessageResourceType=typeof(ValidationErrorResources))] [StringLength(50, ErrorMessageResourceName="ValidationErrorBadPasswordLength", ErrorMessageResourceType=typeof(ValidationErrorResources), MinimumLength=7)] string password)
  807. {
  808. Dictionary<string, object> parameters = new Dictionary<string, object>();
  809. parameters.Add("user", user);
  810. parameters.Add("password", password);
  811. this.ValidateMethod("CreateUser", parameters);
  812. return ((InvokeOperation<CreateUserStatus>)(this.InvokeOperation("CreateUser", typeof(CreateUserStatus), parameters, true, null, null)));
  813. }
  814. /// <summary>
  815. /// Asynchronously invokes the 'IsUsernameAvailable' method of the domain service.
  816. /// </summary>
  817. /// <param name="userName">The value for the 'userName' parameter of this action.</param>
  818. /// <param name="callback">Callback to invoke when the operation completes.</param>
  819. /// <param name="userState">Value to pass to the callback. It can be <c>null</c>.</param>
  820. /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
  821. public InvokeOperation<bool> IsUsernameAvailable(string userName, Action<InvokeOperation<bool>> callback, object userState)
  822. {
  823. Dictionary<string, object> parameters = new Dictionary<string, object>();
  824. parameters.Add("userName", userName);
  825. this.ValidateMethod("IsUsernameAvailable", parameters);
  826. return ((InvokeOperation<bool>)(this.InvokeOperation("IsUsernameAvailable", typeof(bool), parameters, true, callback, userState)));
  827. }
  828. /// <summary>
  829. /// Asynchronously invokes the 'IsUsernameAvailable' method of the domain service.
  830. /// </summary>
  831. /// <param name="userName">The value for the 'userName' parameter of this action.</param>
  832. /// <returns>An operation instance that can be used to manage the asynchronous request.</returns>
  833. public InvokeOperation<bool> IsUsernameAvailable(string userName)
  834. {
  835. Dictionary<string, object> parameters = new Dictionary<string, object>();
  836. parameters.Add("userName", userName);
  837. this.ValidateMethod("IsUsernameAvailable", parameters);
  838. return ((InvokeOperation<bool>)(this.InvokeOperation("IsUsernameAvailable", typeof(bool), parameters, true, null, null)));
  839. }
  840. /// <summary>
  841. /// Creates a new entity container for this domain context's entity sets.
  842. /// </summary>
  843. /// <returns>A new container instance.</returns>
  844. protected override EntityContainer CreateEntityContainer()
  845. {
  846. return new UserRegistrationContextEntityContainer();
  847. }
  848. /// <summary>
  849. /// Service contract for the 'UserRegistrationService' domain service.
  850. /// </summary>
  851. [ServiceContract()]
  852. public interface IUserRegistrationServiceContract
  853. {
  854. /// <summary>
  855. /// Asynchronously invokes the 'CreateUser' operation.
  856. /// </summary>
  857. /// <param name="user">The value for the 'user' parameter of this action.</param>
  858. /// <param name="password">The value for the 'password' parameter of this action.</param>
  859. /// <param name="callback">Callback to invoke on completion.</param>
  860. /// <param name="asyncState">Optional state object.</param>
  861. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  862. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/UserRegistrationService/CreateUserDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  863. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/CreateUser", ReplyAction="http://tempuri.org/UserRegistrationService/CreateUserResponse")]
  864. IAsyncResult BeginCreateUser(RegistrationData user, string password, AsyncCallback callback, object asyncState);
  865. /// <summary>
  866. /// Completes the asynchronous operation begun by 'BeginCreateUser'.
  867. /// </summary>
  868. /// <param name="result">The IAsyncResult returned from 'BeginCreateUser'.</param>
  869. /// <returns>The 'CreateUserStatus' returned from the 'CreateUser' operation.</returns>
  870. CreateUserStatus EndCreateUser(IAsyncResult result);
  871. /// <summary>
  872. /// Asynchronously invokes the 'GetUsers' operation.
  873. /// </summary>
  874. /// <param name="callback">Callback to invoke on completion.</param>
  875. /// <param name="asyncState">Optional state object.</param>
  876. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  877. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/UserRegistrationService/GetUsersDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  878. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/GetUsers", ReplyAction="http://tempuri.org/UserRegistrationService/GetUsersResponse")]
  879. [WebGet()]
  880. IAsyncResult BeginGetUsers(AsyncCallback callback, object asyncState);
  881. /// <summary>
  882. /// Completes the asynchronous operation begun by 'BeginGetUsers'.
  883. /// </summary>
  884. /// <param name="result">The IAsyncResult returned from 'BeginGetUsers'.</param>
  885. /// <returns>The 'QueryResult' returned from the 'GetUsers' operation.</returns>
  886. QueryResult<RegistrationData> EndGetUsers(IAsyncResult result);
  887. /// <summary>
  888. /// Asynchronously invokes the 'IsUsernameAvailable' operation.
  889. /// </summary>
  890. /// <param name="userName">The value for the 'userName' parameter of this action.</param>
  891. /// <param name="callback">Callback to invoke on completion.</param>
  892. /// <param name="asyncState">Optional state object.</param>
  893. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  894. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/UserRegistrationService/IsUsernameAvailableDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  895. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/IsUsernameAvailable", ReplyAction="http://tempuri.org/UserRegistrationService/IsUsernameAvailableResponse")]
  896. IAsyncResult BeginIsUsernameAvailable(string userName, AsyncCallback callback, object asyncState);
  897. /// <summary>
  898. /// Completes the asynchronous operation begun by 'BeginIsUsernameAvailable'.
  899. /// </summary>
  900. /// <param name="result">The IAsyncResult returned from 'BeginIsUsernameAvailable'.</param>
  901. /// <returns>The 'Boolean' returned from the 'IsUsernameAvailable' operation.</returns>
  902. bool EndIsUsernameAvailable(IAsyncResult result);
  903. /// <summary>
  904. /// Asynchronously invokes the 'SubmitChanges' operation.
  905. /// </summary>
  906. /// <param name="changeSet">The change-set to submit.</param>
  907. /// <param name="callback">Callback to invoke on completion.</param>
  908. /// <param name="asyncState">Optional state object.</param>
  909. /// <returns>An IAsyncResult that can be used to monitor the request.</returns>
  910. [FaultContract(typeof(DomainServiceFault), Action="http://tempuri.org/UserRegistrationService/SubmitChangesDomainServiceFault", Name="DomainServiceFault", Namespace="DomainServices")]
  911. [OperationContract(AsyncPattern=true, Action="http://tempuri.org/UserRegistrationService/SubmitChanges", ReplyAction="http://tempuri.org/UserRegistrationService/SubmitChangesResponse")]
  912. IAsyncResult BeginSubmitChanges(IEnumerable<ChangeSetEntry> changeSet, AsyncCallback callback, object asyncState);
  913. /// <summary>
  914. /// Completes the asynchronous operation begun by 'BeginSubmitChanges'.
  915. /// </summary>
  916. /// <param name="result">The IAsyncResult returned from 'BeginSubmitChanges'.</param>
  917. /// <returns>The collection of change-set entry elements returned from 'SubmitChanges'.</returns>
  918. IEnumerable<ChangeSetEntry> EndSubmitChanges(IAsyncResult result);
  919. }
  920. internal sealed class UserRegistrationContextEntityContainer : EntityContainer
  921. {
  922. public UserRegistrationContextEntityContainer()
  923. {
  924. this.CreateEntitySet<RegistrationData>(EntitySetOperations.None);
  925. }
  926. }
  927. }
  928. }
  929. namespace Microsoft.Samples.MSTravel.Web.Models
  930. {
  931. using System;
  932. using System.Collections.Generic;
  933. using System.ComponentModel;
  934. using System.ComponentModel.DataAnnotations;
  935. using System.Linq;
  936. using System.Runtime.Serialization;
  937. using System.ServiceModel.DomainServices;
  938. using System.ServiceModel.DomainServices.Client;
  939. using System.ServiceModel.DomainServices.Client.ApplicationServices;
  940. using System.Xml.Serialization;
  941. /// <summary>
  942. /// The 'Airport' entity class.
  943. /// </summary>
  944. [DataContract(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Samples.MSTravel.Web.Models")]
  945. public sealed partial class Airport : Entity
  946. {
  947. private string _airportCode;
  948. private string _displayName;
  949. private EntityCollection<Flight> _flights;
  950. private EntityCollection<Flight> _flights1;
  951. #region Extensibility Method Definitions
  952. /// <summary>
  953. /// This method is invoked from the constructor once initialization is complete and
  954. /// can be used for further object setup.
  955. /// </summary>
  956. partial void OnCreated();
  957. partial void OnAirportCodeChanging(string value);
  958. partial void OnAirportCodeChanged();
  959. partial void OnDisplayNameChanging(string value);
  960. partial void OnDisplayNameChanged();
  961. #endregion
  962. /// <summary>
  963. /// Initializes a new instance of the <see cref="Airport"/> class.
  964. /// </summary>
  965. public Airport()
  966. {
  967. this.OnCreated();
  968. }
  969. /// <summary>
  970. /// Gets or sets the 'AirportCode' value.
  971. /// </summary>
  972. [DataMember()]
  973. [Editable(false, AllowInitialValue=true)]
  974. [Key()]
  975. [Required()]
  976. [RoundtripOriginal()]
  977. [StringLength(10)]
  978. public string AirportCode
  979. {
  980. get
  981. {
  982. return this._airportCode;
  983. }
  984. set
  985. {
  986. if ((this._airportCode != value))
  987. {
  988. this.OnAirportCodeChanging(value);
  989. this.ValidateProperty("AirportCode", value);
  990. this._airportCode = value;
  991. this.RaisePropertyChanged("AirportCode");
  992. this.OnAirportCodeChanged();
  993. }
  994. }
  995. }
  996. /// <summary>
  997. /// Gets or sets the 'DisplayName' value.
  998. /// </summary>
  999. [DataMember()]
  1000. [Required()]
  1001. [StringLength(150)]
  1002. public string DisplayName
  1003. {
  1004. get
  1005. {
  1006. return this._displayName;
  1007. }
  1008. set
  1009. {
  1010. if ((this._displayName != value))
  1011. {
  1012. this.OnDisplayNameChanging(value);
  1013. this.RaiseDataMemberChanging("DisplayName");
  1014. this.ValidateProperty("DisplayName", value);
  1015. this._displayName = val

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