Exemplo n.º 1
0
        public void DynamicSQLinq_Create_001()
        {
            var expected = "tblPerson";
            var target   = SQLinqHelper.Create(expected);

            Assert.AreEqual(expected, target.TableName);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates an instance of SQLinq that is based off the specified Object Type.
 /// </summary>
 /// <typeparam name="T">The Type to use for creating the SQLinq instance.</typeparam>
 /// <param name="obj">The Object Type to base the SQLinq instance off of.</param>
 /// <param name="tableName">Optional. The database table name to use for generated SQL code. If specified, this will override the Objects name and/or SQLinqTable attribute usage.</param>
 /// <returns>A SQLinq instance.</returns>
 public static SQLinq <T> ToSQLinq <T>(this T obj, string tableName = null, ISqlDialect dialect = null)
 {
     if (dialect == null)
     {
         dialect = DialectProvider.Create();
     }
     return(SQLinqHelper.Create(obj, tableName, dialect));
 }
Exemplo n.º 3
0
        public void DynamicSQLinq_Oracle_Create_001()
        {
            var dialect  = new SQLinq.OracleDialect();
            var expected = "tblPerson";
            var target   = SQLinqHelper.Create(expected, dialect);

            Assert.AreEqual(expected, target.TableName);
        }
Exemplo n.º 4
0
        public void DynamicSQLinqSubQueryJoinExpression_ToSQL_003()
        {
            var query  = SQLinqHelper.Create("test");
            var alias  = "name";
            var clause = "1 = 1";
            var param1 = "test";
            var param2 = 2;

            var target = new DynamicSQLinqSubQueryJoinExpression(query, alias, clause, param1, param2);

            target.ToSQL(parameterNamePrefix: " ");
        }
Exemplo n.º 5
0
        public void DynamicSQLinqSubQueryJoinExpression_Constructor_001()
        {
            var query  = SQLinqHelper.Create("test");
            var alias  = "name";
            var clause = "1 = 1";
            var param1 = "test";
            var param2 = 2;

            var target = new DynamicSQLinqSubQueryJoinExpression(query, alias, clause, param1, param2);

            Assert.AreEqual(DynamicSQLinqJoinOperator.Inner, target.JoinOperator);

            Assert.AreEqual(query, target.Query);
            Assert.AreEqual(alias, target.Alias);
            Assert.AreEqual(clause, target.Clause);
            Assert.AreEqual(param1, target.Parameters[0]);
            Assert.AreEqual(param2, target.Parameters[1]);
        }