コード例 #1
0
ファイル: User.cs プロジェクト: cong1389/BeTongChienThang
        public UserBLL()
        {
            Type t = typeof(Cb.SQLServerDAL.Generic <PNK_User>);

            dal_2C = DataAccessGeneric <PNK_User> .CreateSession(t.FullName);

            switch (ConfigurationManager.AppSettings["Database"])
            {
            case "SQLServer":
                prefixParam = "@";
                break;

            case "MySQL":
                prefixParam = "v_";
                break;
            }
        }
コード例 #2
0
ファイル: NETImport.cs プロジェクト: jmptrader/NClass-1
        /// <summary>
        /// Returns a string containing the type parameter definitions.
        /// </summary>
        /// <param name="generic">An instance of <see cref="IGeneric"/> to take the generic parameters from.</param>
        /// <returns>A string containing the type parameter definitions.</returns>
        private static string GetGenericDefinition(IGeneric generic)
        {
            if (!generic.IsGeneric)
            {
                return("");
            }
            IEnumerable <NRTypeParameter> nrTypeParameters = generic.GenericTypes;
            StringBuilder result = new StringBuilder("<");

            foreach (NRTypeParameter nrTypeParameter in nrTypeParameters)
            {
                result.AppendFormat("{0}, ", nrTypeParameter.Name);
            }
            result.Length -= 2;
            result.Append(">");

            return(result.ToString());
        }
コード例 #3
0
        public static void AssertReadAndWrite <T>(
            IGeneric <T> value,
            T expected,
            int expectedLength,
            Action <ValuePair <T> > assertion = null)
        {
            var actualType = value
                             .GetType();

            if (typeof(T).IsArray)
            {
                expectedLength *= Marshal.SizeOf(typeof(T).GetMethod("Get").ReturnType);
            }

            var actual = (IGeneric <T>)Activator.CreateInstance(actualType);

            var memory = new MemoryStream();
            var reader = new BinaryReader(memory);
            var writer = new BinaryWriter(memory);

            BinaryMapping.WriteObject(writer, value);

            Assert.Equal(expectedLength, memory.Length);

            memory.Position = 0;
            BinaryMapping.ReadObject(reader, actual);

            Assert.Equal(expectedLength, memory.Position);

            if (assertion != null)
            {
                assertion.Invoke(new ValuePair <T>
                {
                    Expected = expected,
                    Actual   = actual.Value
                });
            }
            else
            {
                Assert.Equal(expected, actual.Value);
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the C# generic from the source generic.
        /// </summary>
        /// <param name="sourceGeneric">The source generic.</param>
        public ICSharpGeneric GetGeneric(IGeneric sourceGeneric)
        {
            ICSharpGeneric Result = null;

            foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable)
            {
                foreach (ICSharpGeneric Generic in Entry.Value.GenericList)
                {
                    if (Generic.Source == sourceGeneric)
                    {
                        Debug.Assert(Result == null);
                        Result = Generic;
                    }
                }
            }

            Debug.Assert(Result != null);

            return(Result);
        }
コード例 #5
0
ファイル: CSharp.cs プロジェクト: Victov/NClass
        /// <summary>
        ///     Returns a string containing the generic contraints if any.
        /// </summary>
        /// <param name="generic">An instance of <see cref="IGeneric" /> to take the generic constraints from.</param>
        /// <returns>A string containing the generic contraints.</returns>
        private static string GetGenericConstraint(IGeneric generic)
        {
            if (!generic.IsGeneric)
            {
                return("");
            }
            IEnumerable <NRTypeParameter> nrTypeParameters = generic.GenericTypes;
            StringBuilder result = new StringBuilder( );

            foreach (NRTypeParameter nrTypeParameter in nrTypeParameters)
            {
                if ((nrTypeParameter.BaseTypes.Count == 0) && !nrTypeParameter.IsClass && !nrTypeParameter.IsConstructor && !nrTypeParameter.IsStruct)
                {
                    continue;
                }
                result.AppendFormat(" where {0} : ", nrTypeParameter.Name);
                if (nrTypeParameter.IsClass)
                {
                    result.Append("class, ");
                }
                if (nrTypeParameter.IsStruct)
                {
                    result.Append("struct, ");
                }
                foreach (NRTypeUsage baseType in nrTypeParameter.BaseTypes)
                {
                    result.AppendFormat("{0}, ", baseType.Declaration( ));
                }
                if (nrTypeParameter.IsConstructor)
                {
                    result.Append("new(), ");
                }

                result.Length -= 2;
            }

            return(result.ToString( ));
        }
コード例 #6
0
        /// <summary>
        /// Checks for errors before applying a rule.
        /// </summary>
        /// <param name="node">The node instance to check.</param>
        /// <param name="dataList">Optional data collected during inspection of sources.</param>
        /// <param name="data">Private data to give to Apply() upon return.</param>
        /// <returns>True if an error occured.</returns>
        public override bool CheckConsistency(IConstraint node, IDictionary <ISourceTemplate, object> dataList, out object data)
        {
            bool Success = true;

            data = null;

            IGeneric InnerGeneric = (IGeneric)node.ParentSource;

            Debug.Assert(node.ResolvedParentType.IsAssigned);
            ICompiledType ResolvedType = node.ResolvedParentType.Item;

            foreach (KeyValuePair <ITypeName, ICompiledType> Entry in InnerGeneric.ResolvedConformanceTable)
            {
                ICompiledType OtherConformingType = Entry.Value;
                if (ObjectType.TypesHaveIdenticalSignature(ResolvedType, OtherConformingType))
                {
                    AddSourceError(new ErrorTypeAlreadyUsedAsConstraint((IObjectType)node.ParentType));
                    Success = false;
                }
            }

            return(Success);
        }
コード例 #7
0
 public GenericWrapper(
     IGeneric <string> generic)
 {
     Generic = generic;
 }
コード例 #8
0
 public AppRoleManager(IGeneric <AppRole> generic) : base(generic)
 {
     _generic = generic;
 }
コード例 #9
0
 public EditorasController()
 {
     EditoraRepository = new EditoraRepository();
 }
コード例 #10
0
 public ClassWithGeneric(IGeneric<int> generic)
 {
     this.Generic = generic;
 }
コード例 #11
0
ファイル: Parser.cs プロジェクト: andyhebear/Csharp-Parser
 private void ParsePossibleTypeParameterConstraintNode(IGeneric node)
 {
     // if the current token is "where", the source code is starting 
     // a type parameter constraint
     while (curtok.ID == TokenID.Ident && strings[curtok.Data] == "where")
     {
         Advance(); // advance over Where token
         ParseTypeParameterConstraintNode(node);
     }
 }
コード例 #12
0
 public CategoryService(IGeneric <Category> repository)
 {
     this.repository = repository;
 }
コード例 #13
0
 public GenericServiceWithGenericConstructor(IGeneric <T> arg)
 {
 }
コード例 #14
0
 public ProductManager(IGeneric <Product> generic, IProduct product) : base(generic)
 {
     _product = product;
 }
コード例 #15
0
ファイル: LoanService.cs プロジェクト: Elshan94/LoanApp
 public LoanService(IGeneric <Loan> genericRepository, ILoan loan) : base(genericRepository)
 {
     _genericRepository = genericRepository;
     _loan = loan;
 }
コード例 #16
0
 public Size(IGeneric <uint> generic) => _generic = generic;
コード例 #17
0
ファイル: Parser.cs プロジェクト: mintberry/stackrecaller
        private void ParsePossibleTypeParameterConstraintNode(IGeneric node)
        {
            // if the current token is "where", the source code is starting 
            // a type parameter constraint
            if (curtok.ID == TokenID.Where)
            {
                Advance(); // advance over Where token

                //parse it at least one time out of the next while loop
                // to be sure that at least one type parameter constraint is defined 
                //( for example -> "where " is invalid
                ParseTypeParameterConstraintNode(node);

                while (curtok.ID == TokenID.Where && curtok.ID != TokenID.Eof)
                {
                    Advance(); //over the TokenID.Where

                    ParseTypeParameterConstraintNode(node);
                }
            }
        }
コード例 #18
0
ファイル: Parser.cs プロジェクト: mintberry/stackrecaller
        private void ParseTypeParameterConstraintNode(IGeneric genericType)
        {
            if (curmods != Modifier.Empty)
                ReportError("Type parameter constraint can not contain modifiers");

            ParseTypeParameterNode(false, true, false);

            Constraint node = new Constraint(curTypeParameters[0]);

            curTypeParameters = new List<TypeParameterNode>();

            AssertAndAdvance(TokenID.Colon);

            //parse the first constraint
            ParseConstraintNode(node);

            while( curtok.ID == TokenID.Comma && curtok.ID != TokenID.Eof )
            {
                Advance();
                ParseConstraintNode(node);
            }

            if (!node.TypeParameter.IsEmpty)
            {
                if (!genericType.Generic.TypeParameters.Contains(node.TypeParameter))
                {
                    ReportError("unknow type parameter : " + node.TypeParameter.UniqueIdentifier);
                }
            }

            string key = node.TypeParameter.Identifier.Identifier;

            if (curTypeParameterConstraints.ContainsKey(key))
            {
                ReportError("duplicated constraint for the type parameter '" + key + "'.");
            }

            curTypeParameterConstraints.Add(key, node);
        }
コード例 #19
0
		public UseGenericExtended2(IGenericExtended<string> genericExtended, IGeneric<string> generic)
		{
			this.genericExtended = genericExtended;
			this.generic = generic;
		}
コード例 #20
0
 public DefaultValueTypeDefaults(IGeneric <ISource <object> > generic) => _generic = generic;
コード例 #21
0
ファイル: Parser.cs プロジェクト: mintberry/stackrecaller
        private void ApplyTypeParameterConstraints(IGeneric node)
        {
            if (curTypeParameterConstraints.Count > 0)
            {
                if (node.IsGeneric)
                {
                    node.Generic.Constraints.AddRange( curTypeParameterConstraints.Values );
                    curTypeParameterConstraints = new Dictionary<string, Constraint>();
                }
                else
                {
                    ReportError("Type parameter constraint applies only on generic type or generic method");
                }

            }
        }
コード例 #22
0
 public InvoiceService(IGeneric <Invoice> genericRepository) : base(genericRepository)
 {
     _genericRepository = genericRepository;
 }
コード例 #23
0
 public IGeneric <int>?TargetWithComplexGeneric(IGeneric <int> a) => null;
コード例 #24
0
 public UlogeController(IGeneric <Uloge, object> service) : base(service)
 {
 }
コード例 #25
0
 public ClassWithGeneric(IGeneric <int> generic)
 {
     this.Generic = generic;
 }
コード例 #26
0
 public GenericService(IMapper mapper, IGeneric repo, IErrorlogService errorlogService)
 {
     this._mapper          = mapper;
     this._repo            = repo;
     this._errorlogService = errorlogService;
 }
コード例 #27
0
		public UseGenericExtended1(IGeneric<string> generic, IGenericExtended<string> genericExtended)
		{
			this.generic = generic;
			this.genericExtended = genericExtended;
		}
コード例 #28
0
 public GenericManager(IGeneric <TEntity> generic)
 {
     _generic = generic;
 }
コード例 #29
0
        public XMLConfigBLL()
        {
            Type t = typeof(Cb.SQLServerDAL.Generic <sd_XML>);

            generic = DataAccessGeneric <sd_XML> .CreateSession(t.FullName);
        }
コード例 #30
0
 public Element(IIdentities identities, IGeneric <IIdentity, IWriter> adapter)
 {
     _identities = identities;
     _adapter    = adapter;
 }
コード例 #31
0
ファイル: EngEstService.cs プロジェクト: Iris1987/AngularApp
 public EngEstService(IGeneric <TranslationEngEst> repository)
 {
     this.repository = repository;
 }
コード例 #32
0
ファイル: Service1.cs プロジェクト: mikehac/AutoFacExample
 public Service1(IGeneric generic)
 {
     _generic = generic;
 }
コード例 #33
0
 public Task Handle(IGeneric <Parent> message) => Task.CompletedTask;
コード例 #34
0
 public GenerosController()
 {
     GeneroRepository = new GeneroRepository();
 }
コード例 #35
0
 public GenericFactory(IGeneric<int> intG, IGeneric<string> stringG)
 {
     intGeneric = intG;
     stringG = stringG;
 }
コード例 #36
0
 public FacultyController(IGeneric <Faculty> genericRepository)
 {
     _faculty = genericRepository;
 }
コード例 #37
0
 public ProizvodController(ICRUD <Proizvod, ProizvodSearchRequest, ProizvodUpsertRequest, ProizvodUpsertRequest> service, IGeneric <Proizvod, ProizvodSearchRequest> _base) : base(service, _base)
 {
 }
コード例 #38
0
ファイル: Parser.cs プロジェクト: mintberry/stackrecaller
        private void ApplyTypeParameters(IGeneric node)
        {
            if (curTypeParameters.Count > 0)
            {
                if (node.Generic == null)
                {
                    node.Generic = new GenericNode(curtok);
                    genericList.Add(node);
                }

                node.Generic.TypeParameters.AddRange( curTypeParameters );
                curTypeParameters = new List<TypeParameterNode>();
            }
        }