public DbToolSyntaxProvider(IMetaInfoProvider metaInfoProvider)
        {
            _metaInfoProvider = metaInfoProvider;
            _sqlKeywords = new HashSet<string>(new[]{ "select", "insert", "update", "delete", "drop", "distinct",
                "from", "left", "outer", "join", "on",
                "where", "and", "or", "not", "in",
                "group", "order", "by", "asc", "desc" });
            _functions = new HashSet<string>(new[] { "migrate", "up", "down", "show", "set", "vars", "usings", "$" });
            _operators = new HashSet<string>(new[] {"+", "-", "*", "/", "=", "!", "<", ">", "<>"});
            _separators = new HashSet<char>(new[] {' ', '.', ',', ';','=', '+', '-', '<', '>', '(', ')', '\t', '\n', '\r'});
            _settings = new HashSet<string>(GetSettings());
            _cSharpKeywords = new HashSet<string>(new[]{"var", "void", "string", "object", "dynamic",
                "const", "int", "long", "double", "float", "decimal",  "bool", "true", "false", "char",
                "public", "protected", "private", "virtual", "override", "static", "class",
                "switch", "case", "default", "new", "in", "let", "orderby", "descending", "using"});

            _caseSensitiveWords = new Dictionary<string, TagType>();
            _cSharpKeywords.Each(c => _caseSensitiveWords[c] = TagType.CSharp);

            _words = new Dictionary<string, TagType>();
            _sqlKeywords.Each(w => _words[w] = TagType.SqlKeyword);
            _functions.Each(f => _words[f] = TagType.Function);
            _operators.Each(o => _words[o] = TagType.Operator);
            _settings.Each(s => _words[s] = TagType.Setting);
        }
示例#2
0
        public ObjectExtender(IMetaInfoProvider metaInfoProvider, InjectionParameter[] injectionParameters = null)
        {
            if (injectionParameters != null)
                this.injectionParameters = injectionParameters;

            this.metaInfoProvider = metaInfoProvider;
        }
示例#3
0
        public DbToolSyntaxProvider(IMetaInfoProvider metaInfoProvider)
        {
            _metaInfoProvider = metaInfoProvider;
            _sqlKeywords      = new HashSet <string>(new[] { "select", "insert", "update", "delete", "drop", "distinct",
                                                             "from", "left", "outer", "join", "on",
                                                             "where", "and", "or", "not", "in",
                                                             "group", "order", "by", "asc", "desc" });
            _functions      = new HashSet <string>(new[] { "migrate", "up", "down", "show", "set", "vars", "usings", "$" });
            _operators      = new HashSet <string>(new[] { "+", "-", "*", "/", "=", "!", "<", ">", "<>" });
            _separators     = new HashSet <char>(new[] { ' ', '.', ',', ';', '=', '+', '-', '<', '>', '(', ')', '\t', '\n', '\r' });
            _settings       = new HashSet <string>(GetSettings());
            _cSharpKeywords = new HashSet <string>(new[] { "var", "void", "string", "object", "dynamic",
                                                           "const", "int", "long", "double", "float", "decimal", "bool", "true", "false", "char",
                                                           "public", "protected", "private", "virtual", "override", "static", "class",
                                                           "switch", "case", "default", "new", "in", "let", "orderby", "descending", "using" });

            _caseSensitiveWords = new Dictionary <string, TagType>();
            _cSharpKeywords.Each(c => _caseSensitiveWords[c] = TagType.CSharp);

            _words = new Dictionary <string, TagType>();
            _sqlKeywords.Each(w => _words[w] = TagType.SqlKeyword);
            _functions.Each(f => _words[f]   = TagType.Function);
            _operators.Each(o => _words[o]   = TagType.Operator);
            _settings.Each(s => _words[s]    = TagType.Setting);
        }
示例#4
0
 public WriteMapper(QueryBuilder builder, IMetaInfoProvider metaInfoProvider)
 {
     if (builder == null)
         throw new ArgumentNullException("builder");
     if (metaInfoProvider == null)
         throw new ArgumentNullException("metaInfoProvider");
     _builder = builder;
     _metaInfoProvider = metaInfoProvider;
 }
        public DefaultObjectBuilder(IContainerContext containerContext, IMetaInfoProvider metaInfoProvider,
            IContainerExtensionManager containerExtensionManager, string registrationName,
            InjectionParameter[] injectionParameters = null)
        {
            if (injectionParameters != null)
                this.injectionParameters = injectionParameters;

            this.instanceType = metaInfoProvider.TypeTo;
            this.containerExtensionManager = containerExtensionManager;
            this.registrationName = registrationName;
            this.metaInfoProvider = metaInfoProvider;
            this.containerContext = containerContext;
        }
 public QueryBuilder(IMetaInfoProvider metaInfoProvider)
 {
     if (metaInfoProvider == null)
         throw new ArgumentNullException("metaInfoProvider");
     _metaInfoProvider = metaInfoProvider;
 }
示例#7
0
        public void Setup()
        {
            this.npgsqlTransaction = null;
            this.metaInfoProvider  = new MetaInfoProvider
            {
                DomainOfExpertiseMetaInfo           = new DomainOfExpertiseMetaInfo(),
                IterationSetupMetaInfo              = new IterationSetupMetaInfo(),
                SiteDirectoryDataAnnotationMetaInfo = new SiteDirectoryDataAnnotationMetaInfo(),
                ElementDefinitionMetaInfo           = new ElementDefinitionMetaInfo(),
                ElementUsageMetaInfo      = new ElementUsageMetaInfo(),
                BookMetaInfo              = new BookMetaInfo(),
                ActionItemMetaInfo        = new ActionItemMetaInfo(),
                SiteDirectoryMetaInfo     = new SiteDirectoryMetaInfo(),
                ActualFiniteStateMetaInfo = new ActualFiniteStateMetaInfo(),
                DiagramCanvasMetaInfo     = new DiagramCanvasMetaInfo(),
                EngineeringModelMetaInfo  = new EngineeringModelMetaInfo(),
            };

            this.personRoles = new List <PersonRole>
            {
                new PersonRole
                {
                    Iid              = Guid.NewGuid(),
                    RevisionNumber   = 1,
                    PersonPermission =
                        new List <Guid>
                    {
                        this
                        .personPermission1id,
                        this
                        .personPermission2id,
                        this
                        .personPermission3id
                    }
                }
            };
            this.participantRoles = new List <ParticipantRole>
            {
                new ParticipantRole
                {
                    Iid                   = Guid.NewGuid(),
                    RevisionNumber        = 1,
                    ParticipantPermission =
                        new List <Guid>
                    {
                        this
                        .participantPermission1id,
                        this
                        .participantPermission2id,
                        this
                        .participantPermission3id
                    }
                }
            };



            this.transactionManager = new Mock <ICdp4TransactionManager>();
            NpgsqlConnection connection = null;

            this.transactionManager.Setup(x => x.SetupTransaction(ref connection, null))
            .Returns(this.npgsqlTransaction);

            this.participantPermission1             = new ParticipantPermission(this.participantPermission1id, 1);
            this.participantPermission1.ObjectClass = ClassKind.DomainOfExpertise;
            this.participantPermission2             = new ParticipantPermission(this.participantPermission2id, 1);
            this.participantPermission2.ObjectClass = ClassKind.IterationSetup;
            this.participantPermission3             = new ParticipantPermission(this.participantPermission3id, 1);
            this.participantPermission3.ObjectClass = ClassKind.SiteDirectoryDataAnnotation;
            this.participantPermissionDao           = new Mock <IParticipantPermissionDao>();
            this.participantPermissionDao.Setup(x => x.Read(this.npgsqlTransaction, SiteDirectoryData, It.IsAny <IEnumerable <Guid> >(), true))
            .Returns(
                new List <ParticipantPermission>
            {
                this.participantPermission1,
                this.participantPermission2,
                this.participantPermission3
            });

            this.personPermission1             = new PersonPermission(this.personPermission1id, 1);
            this.personPermission1.ObjectClass = ClassKind.DomainOfExpertise;
            this.personPermission2             = new PersonPermission(this.personPermission2id, 1);
            this.personPermission2.ObjectClass = ClassKind.IterationSetup;
            this.personPermission3             = new PersonPermission(this.personPermission3id, 1);
            this.personPermission3.ObjectClass = ClassKind.SiteDirectoryDataAnnotation;
            this.personPermissionDao           = new Mock <IPersonPermissionDao>();
            this.personPermissionDao.Setup(x => x.Read(this.npgsqlTransaction, SiteDirectoryData, It.IsAny <IEnumerable <Guid> >(), true)).Returns(
                new List <PersonPermission> {
                this.personPermission1, this.personPermission2, this.personPermission3
            });

            this.service = new PermissionInstanceFilterService
            {
                MetadataProvider         = this.metaInfoProvider,
                TransactionManager       = this.transactionManager.Object,
                ParticipantPermissionDao = this.participantPermissionDao.Object,
                PersonPermissionDao      = this.personPermissionDao.Object
            };
        }
 public GenericTypeObjectBuilder(IContainerContext containerContext, IMetaInfoProvider metaInfoProvider)
 {
     this.metaInfoProvider = metaInfoProvider;
     this.containerContext = containerContext;
 }