예제 #1
0
        /// <summary>
        /// Gets the Dynamic binder for the Find and FindById dynamic methods
        /// </summary>
        /// <param name="binder">The binder.</param>
        /// <param name="args">The arguments.</param>
        /// <returns></returns>
        public override IDynamicBinder GetBinder(InvokeMemberBinder binder, object[] args)
        {
            if (MethodCalled(binder, "Find"))
            {
                if (NamedIdArgument.Matches(binder, args) || Position0Argument.Matches(binder, args))
                {
                    return(new FindByIdDynamicBinder(DataWebServiceFactory.Create(), CredentialsProvider.ForUsernameAndPassword("User", "password")));
                }
            }

            if (MethodCalled(binder, "FindById"))
            {
                if (Position0Argument.Matches(binder, args) || NamedIdArgument.Matches(binder, args))
                {
                    return(new FindByIdDynamicBinder(DataWebServiceFactory.Create(), CredentialsProvider.ForUsernameAndPassword("User", "password")));
                }
            }
            return(null);
        }
        protected override void OnSetUp()
        {
            base.OnSetUp();
            database = new SimpleAmplaDatabase();
            database.EnableModule(module);
            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            foreach (string location in locations)
            {
                configuration.AddLocation(module, location);
            }

            configuration.SetDefaultView(module, getViewFunc());

            webServiceClient = new SimpleDataWebServiceClient(database, configuration, new SimpleSecurityWebServiceClient("User"));
            listLogger       = new ListLogger();
            repository       = new AmplaRepository <TModel>(new LoggingDataWebServiceClient(webServiceClient, listLogger),
                                                            CredentialsProvider.ForUsernameAndPassword(userName, password));
        }
 protected override void Load(ContainerBuilder builder)
 {
     base.Load(builder);
     builder.Register(c => CredentialsProvider.ForUsernameAndPassword(userName, password))
     .As <ICredentialsProvider>();
 }
 public DynamicViewPointOperations(DynamicViewPoint viewPoint) : this(viewPoint, DataWebServiceFactory.Create(), CredentialsProvider.ForUsernameAndPassword("User", "password"))
 {
 }