/// <summary> /// Creates a new instance of a DataSource object, and initializes it with the specified configuration options. /// </summary> /// <param name="principalAccessor"></param> /// <param name="mapProfile"></param> DataSource(IPrincipalAccessor principalAccessor, IMapper mapper, ModelProfile profile) { if (principalAccessor == null) { throw new ArgumentNullException(nameof(principalAccessor)); } this.Principal = principalAccessor.Principal; profile.BindDataSource(this); this.Mapper = mapper; //this.Mapper = new MapperConfiguration(config => //{ // mapProfile.BindDataSource(this); // config.AllowNullCollections = true; // config.AddProfile((Profile)mapProfile); //}).CreateMapper(); // TODO: Fix threading issue. // TODO: reflection to auto initialize the services. _helperService = new Lazy <IHelperService>(() => new HelperService(this)); _subscriptionService = new Lazy <ISubscriptionService>(() => new SubscriptionService(this)); _userService = new Lazy <IUserService>(() => new UserService(this)); _accountService = new Lazy <IAccountService>(() => new AccountService(this)); _calendarService = new Lazy <ICalendarService>(() => new CalendarService(this)); _participantService = new Lazy <IParticipantService>(() => new ParticipantService(this)); _eventService = new Lazy <IEventService>(() => new EventService(this)); _activityService = new Lazy <IActivityService>(() => new ActivityService(this)); _openingService = new Lazy <IOpeningService>(() => new OpeningService(this)); _scheduleService = new Lazy <IScheduleService>(() => new ScheduleService(this)); }
protected Mapper CreateMapperProfile() { var myProfile = new ModelProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile)); return(new Mapper(configuration)); }
public ProfileViewModel() { List <ModelProfile> modelProfiles = new List <ModelProfile>(); List <Service.Profile> profiles = ShopWindows.client.GetAllUsers().ToList(); foreach (Service.Profile profile in profiles) { ModelProfile modelProfile = new ModelProfile(); modelProfiles.Add(modelProfile.MakeModelProfile(profile)); } Items1 = CollectionViewSource.GetDefaultView(modelProfiles); Items1.Filter = FilterProfile; }
async void OnItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem == null) { return; } ListView listView = (ListView)sender; ModelProfile declinaisonModel = (ModelProfile)listView.SelectedItem; await Member.CreateFrom(EquipeId, declinaisonModel.Id); await Application.Current.MainPage.Navigation.PopAsync(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { imagesmaets = Environment.CurrentDirectory + @"\Content\"; searchproduct.Focus(); foreach (Service.Product produc in products) { ModelProduct mp = new ModelProduct(); mp = mp.MakeModelProduct(produc); Lvm.Items.Add(mp); } foreach (Service.Profile produc in profilesq) { ModelProfile mp = new ModelProfile(); mp = mp.MakeModelProfile(produc); AllUser.Items.Add(mp); } Lvm.Visibility = Visibility.Hidden; }
/// <summary> /// Adds the datasource to the service collection and configures the DbContext options. /// </summary> /// <param name="services"></param> /// <param name="optionsBuilder"></param> /// <returns></returns> public static IServiceCollection AddDataSource(this IServiceCollection services, Action <DataSourceOptionsBuilder> setupAction) { var builder = new DataSourceOptionsBuilder(); setupAction?.Invoke(builder); services.AddSingleton <DbContextOptions>(builder.Options); services.AddSingleton(builder.Options); var profile = new ModelProfile(); var mapper = new MapperConfiguration(config => { //profile.BindDataSource(this); config.AllowNullCollections = true; config.AddProfile((Profile)profile); }).CreateMapper(); services.AddSingleton <ModelProfile>(profile); services.AddSingleton <IMapper>(mapper); services.AddScoped <IDataSource, DataSource>(); return(services); }
private void FilterUser_TextChanged(object sender, TextChangedEventArgs e) { if (FilterUser.Text != "") { AllUser.Items.Clear(); p = client.GetProfileByFilter(FilterUser.Text).ToList(); foreach (Service.Profile produc in p) { ModelProfile mp = new ModelProfile(); mp = mp.MakeModelProfile(produc); AllUser.Items.Add(mp); } } else { AllUser.Items.Clear(); foreach (Service.Profile produc in profilesq) { ModelProfile mp = new ModelProfile(); mp = mp.MakeModelProfile(produc); AllUser.Items.Add(mp); } } }
private bool CanModelProfileUseWeapon(ModelProfile modelProfile, string weaponId) { Debug.Assert(this.modelProfileToWeapons != null); return(this.modelProfileToWeapons[modelProfile.Id].Any(w => w.Id == weaponId)); }
public ActionResult EditModel(int idkk) { ModelProfile modelProfile = _context.ModelProfiles.Where(mm => mm.Id.Equals(idkk)).FirstOrDefault(); return(View(modelProfile)); }
/// <summary> /// Creates a new instance of a DataSource object, and initializes it with the specified configuration options. /// </summary> /// <param name="options"></param> /// <param name="principalAccessor"></param> /// <param name="mapProfile"></param> public DataSource(DbContextOptions options, IPrincipalAccessor principalAccessor, IMapper mapper, ModelProfile profile) : this(principalAccessor, mapper, profile) { this.Context = new ScheduleContext(options); }