Guest User

Untitled

a guest
Jun 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1.  
  2. namespace LSUserLookupWCF
  3. {
  4.     using System;
  5.     using System.Collections.Generic;
  6.     using System.ComponentModel;
  7.     using System.ComponentModel.DataAnnotations;
  8.     using System.Linq;
  9.     using System.ServiceModel.DomainServices.Hosting;
  10.     using System.ServiceModel.DomainServices.Server;
  11.  
  12.     using Microsoft.LightSwitch;
  13.     using Microsoft.LightSwitch.Framework.Base;
  14.     using System.Transactions;
  15.  
  16.     // TODO: Create methods containing your application logic.
  17.     [EnableClientAccess()]
  18.     public class ServisZaLSUsera : DomainService
  19.     {
  20.         [Query(IsDefault = true)]
  21.         public IEnumerable<LSUser> GetLSUsers()
  22.         {
  23.             Transaction.Current = null;
  24.             try
  25.             {
  26.                 IDataWorkspace workspace = ApplicationProvider.Current.CreateDataWorkspace();
  27.  
  28.                 IEnumerable<Microsoft.LightSwitch.Security.UserRegistration> users
  29.                     = workspace.SecurityData.UserRegistrations.GetQuery().Execute();
  30.  
  31.                 return from u in users
  32.                        select new LSUser()
  33.                        {
  34.                            UserName = u.UserName,
  35.                            UserFullName = u.FullName
  36.                        };
  37.             }
  38.             catch
  39.             {
  40.  
  41.                 return null;
  42.             }
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment