subsonic / SubSonic-3.0
- Source
- Commits
- Network (141)
- Issues (67)
- Downloads (4)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
1 comment Created 6 months ago by jchannonError in ExpressionVisitor.cs - VisitUnary when doing a NOT IN expressionAcceptedxTo replicate this try the following
List excluded = new List();
var f = WebPageContent.Find(x => !usedID.Any(e => e == x.ID));I know there is nothing in the list but in my scenario I have a list that might get populated so I need to do a Find then a Delete. I have tried doing just a Delete for less code and less DB hitss but there is a bug in the Delete lambda expression when doing a NOT IN type scenario. See Github issue 62.
At the moment I am having to do this:
if (usedID.Count > 0)
{ var f = WebPageContent.Find(x => !usedID.Any(e => e == x.ID));
if (f.Count > 0) { var repo = WebPageContent.GetRepo(); repo.Delete(f); }}
I should just be able to do WebPageContent.Delete(x => !usedID.Any(e => e == x.ID));
Comments
-
1 comment Created 6 months ago by shawiiingGrave "accents" incorrect with MySql providerMySQLx3.0.0.3 SimpleRepository issue with MySQL Server 5.1 and .Net Connector 6.0.4
var p = repo.GetPaged(index, pagesize)
Throws a MySQL syntax exception when run. After doing some digging (getting the logs to work) this is the query that is being executed:
SELECT COUNT(``id``) AS `CountOfid` FROM Sales; //Does not work
SELECT COUNT(id) AS CountOfid FROM Sales; //Ran this to make sure it wasn't an issue in the DB and it runs like a champ.
Comments
Please log in to comment.Ok so got brave and downloaded the source and hacked my own fix.
Looks like removing all of the grave characters (`) in the method below resolves the issue. I need to do more testing to make sure they weren't in there for a reason.
The method in question is:
protected override string GenerateAggregateSelect(Aggregate aggregate) -
6 comments Created 6 months ago by matwareLambda Parameter not in scope when using SimpleRepository FindAcceptedxI have this simple little method that is trying to use the SimpleRepositry Find method in SubSonic 3.0.0.3. When I make the call I get a invalid operation exception "Lambda Parameter not in scope".
To reproduce this fault I used the following code :class SimpleCustomer
{ /// <summary> /// Gets or sets the customer GUID. /// </summary> /// <value>The customer GUID.</value> public Guid CustomerGUID { get; set; } /// <summary> /// Gets or sets the ID tag number that is assigned to the customer /// </summary> /// <value>The ID.</value> public string ID { get; set; } public bool Active { get; set; } /// <summary> /// Gets or sets the first names. /// </summary> /// <value>The first names.</value> public string FirstNames { get; set; } /// <summary> /// Gets or sets the last names. /// </summary> /// <value>The last names.</value> public string LastNames { get; set; } } public static void AddSimpleCustomer() { SimpleRepository repos = new SimpleRepository("EmptyDB", SimpleRepositoryOptions.RunMigrations); string searchTerm = "jon"; string id = "00033221100"; SimpleCustomer x = new SimpleCustomer(); if (repos.Exists<SimpleCustomer>(c => c.ID == id) == false) { x.FirstNames = "John"; x.LastNames = "Smith"; x.ID = id; x.CustomerGUID = Guid.NewGuid(); repos.Add<SimpleCustomer>(x); } // Boom - Thinks go horribly wrong here SimpleCustomer y = repos.Find<SimpleCustomer>(c => c.FirstNames.StartsWith(searchTerm)).FirstOrDefault(); //Or Here y = repos.Find<SimpleCustomer>(c => c.FirstNames.Contains(searchTerm)).FirstOrDefault(); }I can work around this issue using
public override IEnumerable FindCustomers(string searchTerm)
{ return Repos.All<Customer>().Where(cust => cust.FirstNames.Contains(searchTerm) || cust.LastNames.Contains(searchTerm)).ToArray(); }But given that it is using the All method, I suspect that this may not scale well :-)
Comments
I added support for StartsWith/EndsWith recently - can you pull the latest source and tell me what happens? Also - All() is just IQueryable so your workaround is the same query.
Thanks for that, I checked out the latests version, and still no dice, and I've got to say sorry, the way it worked was to do
return Repos.All().ToArray().Where(cust => cust.FirstNames.Contains(searchTerm) || cust.LastNames.Contains(searchTerm)).ToArray();I must have had one too many beers and not transcribed my code correctly. The result is that we are querying an in memory buffer, rather than user the glory of SQL.
I grabbed the latest release, compiled it up, and still no luck I get
System.InvalidOperationException was unhandled by user code "Lambda Parameter not in scope" at line 70 of QueryVisitor. It is worth asking at this point if you are looking for the issue using a simple repository, I notice that the tests for "contains" is actually using the ActivedRecord pattern instead.
I might have to have to bend my mind expression trees and try to work out what its doing, thus what's going on. In the mean time, I'd like to add some unit test to the SelectTests that test SimpleReposity, is there any doc as to how to get the unit tests up and going in visual studio?I added the following to SubSonic.Extensions.QueryVisitor and solved my problems:
////// Converts the string method calls Contains,EndsWith and StartsWith into queries /// </summary> /// <param name="m">The MethodCall we are attempting to map to a query.</param> /// <returns>an expression tree.</returns> protected override Expression VisitMethodCall(MethodCallExpression m) { Expression result = m; var obj = m.Object as MemberExpression; if (obj != null) { var c = new Constraint(); switch (m.Method.Name) { case "Contains": c.Comparison = Comparison.Like; break; case "EndsWith": c.Comparison = Comparison.StartsWith; break; case "StartsWith": c.Comparison = Comparison.StartsWith; break; default: return base.VisitMethodCall(m); } // Set the starting / ending wildcards on the parameter value... not the best place to do this, but I'm // attempting to constrain the scope of the change. c.ConstructionFragment = obj.Member.Name; // Set the current constraint... Visit will be using it, I don't know what it would do with multiple args.... current = c; foreach (var arg in m.Arguments) { isLeft = false; Visit(arg); } isLeft = true; // After Visit, the current constraint will have some parameters, so set the wildcards on the parameter. SetConstraintWildcards(c); } AddConstraint(); return m; } protected void SetConstraintWildcards(Constraint c) { if (c.ParameterValue is string) { switch (c.Comparison) { case Comparison.StartsWith: c.ParameterValue = c.ParameterValue + "%"; break; case Comparison.EndsWith: c.ParameterValue = "%" + c.ParameterValue; break; case Comparison.Like: c.ParameterValue = "%" + c.ParameterValue + "%"; break; } } }If somebody is keen you could add it to the master and test it.
Please log in to comment.Oops, you've also got to add support for startswith and endswith to SubSonic.Query.Constraint.GetComparisonOperator:
case Comparison.StartsWith: sOut = SqlComparison.LIKE; break; case Comparison.EndsWith: sOut = SqlComparison.LIKE; break; -
1 comment Created 6 months ago by awbackerActiveRecord crashes when updating table with Computed Column (mssql, pull)AcceptedxActiveRecord attempts to update computed columns in sql server. This effectively means that any table with a computed column can not be used.
These two commits add awareness of Computed columns, to the templates and the core.
- Computed columns can still be updated in code
- Core will not try to update/insert a column that is computed
In the future, it should make computed column property "protected set" , and not add them to the dirty columns collection.
http://github.com/awbacker/SubSonic-3.0/commit/e8141cffb4c5a6c22269f402c7e08dcfc8ff6c23
http://github.com/awbacker/SubSonic-3.0-Templates/commit/d32b69f8f4a484c77567207a071f0caa46038701Sorry about the CS files in there, don't know what to do bout that since I am so new to GIT.
Comments
-
1 comment Created 6 months ago by nathanbMediumTrust SecurityException on when pulling from DB.[Table]Accepted for 3.1xThere are some issues with the current trunk and invoking the datacontext.[Tables]. Count() or .Where(). I tried testing this today. My code is using trunk/master subsonic and active record templates from today (8/7/2009 @ 6PM CST)
Saving, getting, and deleting a single row worked fine in MediumTrust. When I tried to do a DB.Table.Where(o=> expression).ToList(); I got the SecurityException below. (this also happened when trying to pull all rows with a simple LINQ query. (from row in DB.Tables select row);
I don't have any suggestions yet. I believe this is happening on a Compile() function; possibly where the expression tree is constructed??? I haven't dug into it yet.
Error: System.MethodAccessException: System.Runtime.CompilerServices.StrongBox
1..ctor(System.__Canon) ---> System.Security.SecurityException: Request failed.<br/> at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)<br/> at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)<br/> at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)<br/> at System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh)<br/> at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh)<br/> at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)<br/> at System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)<br/> at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext)<br/> at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)<br/> The action that failed was:<br/> Demand<br/> The type of the first permission that failed was:<br/> System.Security.PermissionSet<br/> --- End of inner exception stack trace --- at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)<br/> at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)<br/> at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)<br/> at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)<br/> at System.Linq.Expressions.ExpressionCompiler.AddGlobal(Type type, Object value)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateConstant(ILGenerator gen, Type type, Object value, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateConstant(ILGenerator gen, ConstantExpression c, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateArgs(ILGenerator gen, ParameterInfo[] pis, ReadOnlyCollection1 args)
at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodInfo mi, ReadOnlyCollection1 args, Type objectType)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodCallExpression mc, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateConvert(ILGenerator gen, UnaryExpression u)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateConditional(ILGenerator gen, ConditionalExpression b)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateMemberAssignment(ILGenerator gen, MemberAssignment binding, Type objectType)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateBinding(ILGenerator gen, MemberBinding binding, Type objectType)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateMemberInit(ILGenerator gen, ReadOnlyCollection1 bindings, Boolean keepOnStack, Type objectType)
at System.Linq.Expressions.ExpressionCompiler.GenerateMemberInit(ILGenerator gen, MemberInitExpression init)
at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.GenerateLambda(LambdaExpression lambda)
at System.Linq.Expressions.ExpressionCompiler.GenerateCreateDelegate(ILGenerator gen, LambdaExpression lambda)
at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.GenerateArgs(ILGenerator gen, ParameterInfo[] pis, ReadOnlyCollection1 args)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateNew(ILGenerator gen, NewExpression nex, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateArgs(ILGenerator gen, ParameterInfo[] pis, ReadOnlyCollection1 args)
at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodInfo mi, ReadOnlyCollection1 args, Type objectType)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodCallExpression mc, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateArgs(ILGenerator gen, ParameterInfo[] pis, ReadOnlyCollection1 args)
at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodInfo mi, ReadOnlyCollection1 args, Type objectType)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateMethodCall(ILGenerator gen, MethodCallExpression mc, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateConvert(ILGenerator gen, UnaryExpression u)<br/> at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)<br/> at System.Linq.Expressions.ExpressionCompiler.GenerateLambda(LambdaExpression lambda)<br/> at System.Linq.Expressions.ExpressionCompiler.CompileDynamicLambda(LambdaExpression lambda)<br/> at System.Linq.Expressions.Expression1.Compile()
at SubSonic.Linq.Structure.DbQueryProvider.Execute(Expression expression)
at SubSonic.Linq.Structure.QueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
at SubSonic.Linq.Structure.Query1.GetEnumerator()<br/> at System.Collections.Generic.List1..ctor(IEnumerable1 collection)<br/> at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)Comments
-
1 comment Created 6 months ago by carloskleinSubSonic.Query.Insert error caused by MakePluralMySQLxI am using activerecord (last subsonic source, with MySQL) and my table name is Payment. SubSonic generates a Payment class. Great! Almost everything works. One exception is SubSonic.Query.Insert, who calls the ToSchemaTable (there is a call to MakePlural there). As result, a obtain a wrong sql command, with Payments.
How a im doing:
SubSonic.Query.BatchQuery batch = new BatchQuery(); var query = new SubSonic.Query.Insert(provider).Into<Payment>(new String[] { "Number", "Document", "ServiceNumber", "PaymentDate", "FreeDate" }) .Values(new Object[] { payment.Number, payment.Document, payment.ServiceNumber, payment.PaymentDate.ToString("yyyy-MM-dd HH:mm:ss"), payment.FreeDate.Value.ToString("yyyy-MM-dd HH:mm:ss") }); batch.Queue(query); batch.Execute();Comments
Please log in to comment.
westernmonster
Fri Dec 18 06:57:42 -0800 2009
| link
I have the same problem.
-
3 comments Created 6 months ago by BatteryManVB.NETxActiveRecord: calling Find() on column that allows nulls results in incorrect SQLAcceptedxWhen I call Find() on a column that allows nulls, SubSonic is generating incorrect SQL. This happens only when I call Find() from a VB.NET project (SubSonic + templates are in a separate C# project in the same solution). If I call Find() from a C# project, there is no problem.
Details:
- latest SubSonic 3 (master branch, dated 2009-07-27) and ActiveRecord
- MS SQL Server 2005 Express Edition.
- Visual Studio 2008 solution
- SubSonic and T4 templates in a C# class library project
- My VB application in a separate project referencing the SubSonic project
Here's my table:
CREATE TABLE [dbo].[Fruit]( [FruitID] [int] NOT NULL, [ColorID] [int] NULL, CONSTRAINT [PK_Fruit] PRIMARY KEY CLUSTERED ...In my VB code, I have
Dim bar = Fruit.Find(Function(f As Fruit) f.ColorID = 1)SubSonic generates the following SQL
SELECT [t0].[ColorID], [t0].[FruitID] FROM [dbo].[Fruit] AS t0 WHERE ([t0].[ColorID] = 1) <> 0which fails to execute in DBDataProvider.ExecuteReader with
SqlException was unhandled by user code Incorrect syntax near '<'If I make the ColorID column "NOT NULL", the query generates correctly as:
SELECT [t0].[ColorID], [t0].[FruitID] FROM [dbo].[Fruit] AS t0 WHERE ([t0].[ColorID] = 1)If I execute the following equivalent Find() in C#, I also have no problems:
var foo = FooDB.Fruit.Find(x => x.ColorID == 1);Please let me know if you need more information. If there are any workarounds that I can use until this makes it in, I'd appreciate it.
Comments
My beloved VB.NET wraps an UnaryExpression around the expression f.ColorID = 1 so that it becomes (f.ColorID = 1) <> False. At which point, this confuses the TSqlFormatter or something along the line. Am investigating now to track down a good solution to this problem.
Apocatastasis
Fri Nov 20 12:17:46 -0800 2009
| link
In the meantime, how I can use Subsonic in a VB.NET project? Is C# or nothing for now?
Please log in to comment.Unfortunately, it is not ideal for VB.NET
I've started attempting to track down how to fix the quirks with LINQ and VB.NET but I've recently had all my free time used up with the birth of my first child two months ago.
Tis funny how the introduction of a baby to the house everything changes. -
varbinary not returned by Subsonic Query, always set to null
0 comments Created 5 months ago by KaarelI have a column in SQL Server 2005 table of type varbinary(MAX). Generated active record class has the corresponding property type byte[]. I can successfully new-up the active record class representing the table, initialize values and save. The static method Find of the active record class returns the full set of data. When using the SubSonic.Linq.Structure.Query<T> then the byte[] field is always null.
In other words
var query = new Query<MyTable>();
var result = (from x in query select x).ToList();if MyTable has a property of type byte[] (varbinary(MAX) in SQL Server 2005) then that property is always null in the result.
Comments
Please log in to comment. -
2 comments Created 5 months ago by jamesewelchThe member 'xxx' is not supported error when using GUID as Find parameterAcceptedxWhen querying using a GUID, the following error is returned:
The member 'xxx' is not supported. (xxx is the property name)
Example code:
Guid myId = new Guid("EE4FB3A9-2039-40FC-8241-F97967CF38A1");
IList test = Document.Find(x => x.xxx == myId);Comments
jamesewelch
Fri Aug 28 10:45:16 -0700 2009
| link
Might this be the problem?
http://stackoverflow.com/questions/1325592/subsonic-3-linq-join-problems/1343416#1343416
Please log in to comment.this is a available in my forked version of the source and I have also notified Rob to merge the branch back into the trunk.
else if (m.Member.MemberType == System.Reflection.MemberTypes.Property)
{ // this logic block is to allow for a reflected property to be used in the where clause. // Kenneth Carter 10/30/2009 sb.Append(m.Member.Name); return m; } -
Database values aren't loaded into all fields
4 comments Created 5 months ago by jamesewelchI have various columns that aren't loading into my objects. None of the columns that are affected by naming changes resulting from my modified CleanUp method are being loaded. In this function, I'm just replacing underscores with string.empty and fixing the capitalization back like SubSonic 2.x, so "my_table" becomes "MyTable". The fields that weren't affected (other than capitalization changes) load fine.
Comments
have you change Subsonic.Core.dll for your modification? I think you have to change there as well
jamesewelch
Thu Aug 20 14:10:26 -0700 2009
| link
I haven't changed Subsonic.Core. I only changed CleanUp to remove underscores and fix capitalizations.
Maybe that is the problem, somehow subsonic.core need reference from classes that is created by activerecord t4 templates. both of these have to synchronize one to another...IMO
For example like this, http://github.com/funky81/SubSonic-3.0/tree/d73482c27d46602cbd105344ca28c4516c3c5d30/SubSonic.Core/Linq/Structure/ImplicitMapping.cs , please check line number 103
Please log in to comment.
jamesewelch
Fri Aug 28 10:41:12 -0700 2009
| link
Discussed further at http://stackoverflow.com/questions/1324716/subsonic-3-activerecord-issues-blank-data
-
0 comments Created 5 months ago by tuanvtError Using subsonic for group by query in vb.netVB.NETxHello, I have a table called QuizItem that have these fields
id As Int
created As DateTime
header As Sring
body As String
fk_parent As int
url As StringAll the items without parent key would be the question, and ones that have the parent key would be the answer. I am having the problem to get all the latest active questions (based both on questions created time and and answer created time).
I have used the following approach to do the query but keep getting the error or wrong result( answer and questions in diffrent group), is there some issue with the subsonic vb template, or my code is wrong, or sth else, any one can help me please.
From q In Quiz.Data.QuizItem.All Group q By masterID = If(q.FK_Parent Is Nothing, q.ID, q.ID) Into g = Group _
Order By g.Max(Function(q2) q2.Created) Descending Select New With {.masterItem = (From q3 In g Where q3.FK_Parent Is Nothing Select q3).Single}Any idea is appreciated
Comments
Please log in to comment. -
3 comments Created 5 months ago by jonhiltTestRepository Find returns all recordsFix requires verificationxpublic IQueryable Find(Expression<Func<T, bool>> expression)
in TestRepository returns all records, making unit tests which rely on the Active Record Testing using Find or SingleOrDefault fail.
Comments
I am having the same problem and it makes it IMPOSSIBLE to test... This line of code:
var dbFriend = Friend.SingleOrDefault(f => f.UserId == id && f.FriendId == friendId);Always returns the first element regardless of whether the expression is matched or not. This happens because of
var results=repo.Find(expression);in the ActiveRecord.cs file.
I tried to step through it but couldn't figure it out.
My table looks like this:
FriendUserId - unique, bigint, auto increment
FriendId - big int
UserId - big inI also noticed that the autoincrement features doesn't work in test mode. Is that correct behavior?
I'm having the same issue when using the Test Repository. When I change the tests to use a test database, I have no issues. I would love to see this fixed as I'd rather not use a database for testing.
@eibrahim: Autoincrement isn't supposed to work with the Test Repo according to the answer given by rob here -> http://stackoverflow.com/questions/1508706/
Please log in to comment.I figured out it was a case of the Find() method in TestRepository that was just returning the list. Then I noticed @eibrahim had created a fix for this in master. I downloaded master and compiled and everything seems to be working.
Thanks!
-
1 comment Created 5 months ago by cssMySQL.Data 5.1.7.0, BOOL aka tinyint and ParameterMarkerWill closexWhat lead me down this road was the BOOL/TINYINT/SByte problem mentioned in issue #Num: #95 Figuring out the same as defacer.
After some digging around I find this: http://lists.mysql.com/commits/79014
And decide to try update MySQL.Data, I was using 5.2.5 iirc. I tried only 5.2.7 and 5.1.7 (and 5.2.5).
I got the same TINYINT -> SByte problem in all but 5.1.7. In the latter I now figure out that the ParameterMarker is ? and DbDataProvider.cs:104 ExecuteReader(QueryCommand qry) throws on /SubSonic.Core/DataProviders/DbDataProvider.cs#L130. saying "Column 'XYZ' cannot be null", even if parameters are added to the command. I found http://forums.mysql.com/read.php?38,200568,200573#msg-200573 and added "old syntax=true" in my connection string. Now instead I get a bunch of warnings for every query (I assume):[23.08.2009 11:28:39] - WARNING:You are using old syntax that will be removed in future versions
coupled with
A first chance exception of type 'System.ArgumentException' occurred in System.Core.dll
stemming from SubSonic.Core/Linq/Structure/QueryMapping.cs#L159 in Output tool window.
I ask what have I done wrong? Do I not deserve SubSonic???
Comments
-
SubSonicPrimaryKey attribute does not stack with SubSonicStringLength attribute
0 comments Created 5 months ago by Dangph- Delete the Products table from an Sqlite3 database.
- Run the following code. This will add a Product to the Products table, creating the table in the process.
Result: The MyID field will have type nvarchar. Expected: MyID should have type nvarchar(10).
namespace ss3simple {
}class Product { [SubSonicPrimaryKey] [SubSonicStringLength(10)] public string MyID { get; set; } [SubSonicStringLength(11)] public string Value { get; set; } public Product(string a, string b) { MyID = a; Value = b; } public Product() { } } class Program { static void Main(string[] args) { var repo = new SimpleRepository(SimpleRepositoryOptions.RunMigrations); repo.Add(new Product("hi", "there")); } }
Comments
Please log in to comment. - Delete the Products table from an Sqlite3 database.
-
4 comments Created 5 months ago by ScGitSQLite Table Names and T4 TemplatePossible for 3.1xUsing SQLite v3 and ActiveRecord pattern.Created a table named "User.Categories". When the T4 template is run, the "." in the name seems to cause a problem with namespaces and therefore class generation.
Comments
jamesewelch
Wed Aug 26 09:09:40 -0700 2009
| link
You need to update the ActiveRecord.tt file's CleanUp method to remove any "." and replace it with string.empty or underscore, etc. You may run into another bug (seee #107), but the CleanUp method will get you past this first hurdle.
I found the CleanUp method in Settings.ttinclude, I'll make the change and see what happens. It would be nice to be able to use periods though...
Thanks!
jamesewelch
Fri Aug 28 10:40:32 -0700 2009
| link
You can't use periods because that's used to separate classes, namespaces, methods, properties, etc. It's a reserved symbol (that's probably not the correct phrase) just like how "*", commas, semicolons, etc. can't be used in a object's name.
Please log in to comment.It'd be nice to improve CleanUp for version 3.1 we should consider this
-
2 comments Created 4 months ago by CmdrTallenStored ProcedurexWorkaround AvailablexFailure to identify Stored Procedure Output ParameterAcceptedxHi using Subsonic 3.0.0.3 and MS SQL 2008 (10.0.2531) it appears there is some issue with Subsonic identifying Stored Procedure paramters as output parameters.
In the StoredProcedures.cs class I find my stored procedure definition but the last parameter is defined incorrectly as a 'AddParameter'.
sp.Command.AddParameter("HasPermission",HasPermission,DbType.Boolean);
When I sp.Execute() and attempt to read the value of the sp.Command.OutputValues[0] the value is null.If the definition is edited to be like this;
sp.Command.AddOutputParameter("HasPermission", DbType.Boolean);
Then the value is returned and is correct value typeI am not sure how I 'fix' this - as everytime I regen the SP class via the 'Run Custom Tool' the parameter definitions require editing. Should I edit a T4 template somehow?
Please advise.
Comments
Having the same issues against 3.0.0.3 and MS SQL Express 2008. Easy to work around, but a more permanent fix would be nice.
Please log in to comment.Never mind, just sat down and learned to hack T4 a bit and fixed it myself. Now, if I can just bother to try git I could even submit a patch.. :P
-
Issue of QueryMapping.cs,on custom fields or properties
1 comment Created 4 months ago by mamboerThe GetTypeProjection method (line147) will throw an unhandled exception "Type 'System.Collections.Generic.IList`1[System.String]' does not have a default constructor" if i add some custom properties of type like IList{String},when the code runs at "return Expression.MemberInit(Expression.New(type), bindings);".
I think that the GetMappedMembers(type) method should exclude those custom fields and properties,because they don't belong to the ActiveRecord model,they are just custom added for certain biz intentions.
Comments
-
1 comment Created 4 months ago by sonofabitdata types allowed for primary key?Will closexI attempted to make a primary key with UInt64, but no matter what I did it wouldn't run. however when I changed the datatype to long, it worked right on...
what are the datatypes allowed for the primary key?
Comments
-
2 comments Created 4 months ago by sonofabitsimplerepository: disable autoincrement?Possible for 3.1xI tried to find an attribute to disable autoinc key for the primary key, but couldn't find one.
is there a way to disable the auto increment so that I can set the id manually?
thanks!
Comments
Possibly worth a stackoverflow question. Will close if not issue identified.
Please log in to comment.
saintedlama
Sun Jan 31 20:47:51 -0800 2010
| link
We could realize it via custom attribute extensions discussed in subsonic group under http://groups.google.com/group/subsonicproject/browse_frm/thread/f8bf2810d0eb818c
-
SQL 2008 comes with the new datatype geography which is currently not supported. It should map to Microsoft.SqlServer.Types.SqlGeography or be converted to a byte array.
Comments
-
2 comments Created 4 months ago by marektomsaNullReferenceException when calling Update method on SimpleRepositoryAcceptedxSimpleRepository.Update method throws NullReferenceException when called with non-null arguments.
Following model class:
public class Person { public long ID {get;set;} public string Name { get; set;} }ASP.NET MVC controller action:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection collection) { Person toUpdate = Repository.All<Person>().Single(p => p.ID == id); //is not null, found by ID. TryUpdateModel(toUpdate, collection.ToValueProvider()); //updates model instance successfully. No property of model instance is null Repository.Update(toUpdate); //throws nullreferenceexception return RedirectToAction("Index"); }stack trace:
at SubSonic.Query.Update.GetCommand()
at SubSonic.Query.Update.Execute()
at SubSonic.Repository.SimpleRepository.Update[T](T item)
at MvcApplication1.Controllers.PersonController.Edit(Int32 id, FormCollection collection)
in H:\...\Controllers\PersonController.cs:line 71"No additional information is available in exception details.
My configuration: SubSonic 3, SQLite, empty database
Addtional notes: Querying and saving instances in db works with no problemComments
I think I found the problem here. I was working with it also and found the same issue. It's a comparison issue when the update generator is setting the values for the udpate statement. It makes a comparison between column names where one side is a column name and the other side is the Qualified Column name. I'm committing a patch right now. The only caveat is that the fix may affect other providers.
Please log in to comment.No arquivo Update.cs dentro da pasta Query, na linha 186 inseria o code:
In file Update.cs, in the folder Query, in the line 186 insert the code:internal Setting CreateSetting(IColumn column, bool isExpression) {
Setting s = new Setting { query = this, ColumnName = column.Name, ParameterName = (_provider.ParameterPrefix + "up_" + column.Name), IsExpression = isExpression, DataType = column.DataType }; return s; } -
0 comments Created 4 months ago by AntiGameZTransaction cannot execute successful with subsonic 3.0.0.3AcceptedxMy code follow SubSonic's transaction documentation (reversed TransactionScope and SharedDbConnectionScope).
But I can not commit. Every time a second Save() method execute will throw an InvalidOperationException(already an open datareader).
My environment:
VS 2008, SQL 05/08 (chinese simplified)StackTrace: System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) +4848228
System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +23 System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +144 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +87 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 System.Data.Common.DbCommand.ExecuteReader() +12 SubSonic.DataProviders.DbDataProvider.ExecuteReader(QueryCommand qry) +375 SubSonic.Repository.SubSonicRepository1.Add(T item, IDataProvider provider) +300 AGZ.MvcTest.Models.User.Add(IDataProvider provider) in D:\Writing - 代码撰写中\NewTech - 新技术测试\AGZ.MvcTest\AGZ.MvcTest\Models\_generated\ActiveRecord.cs:397 AGZ.MvcTest.Models.User.Save(IDataProvider provider) in D:\Writing - 代码撰写中\NewTech - 新技术测试\AGZ.MvcTest\AGZ.MvcTest\Models\_generated\ActiveRecord.cs:412 AGZ.MvcTest.Models.User.Save() in D:\Writing - 代码撰写中\NewTech - 新技术测试\AGZ.MvcTest\AGZ.MvcTest\Models\_generated\ActiveRecord.cs:406 AGZ.MvcTest.Controllers.ScopeTestController.Index() in D:\Writing - 代码撰写中\NewTech - 新技术测试\AGZ.MvcTest\AGZ.MvcTest\Controllers\ScopeTestController.cs:34 lambda_method(ExecutionScope , ControllerBase , Object[] ) +74 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +178 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +24 System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +52 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +254 System.Web.Mvc.<>cDisplayClassc.b9() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +192 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399 System.Web.Mvc.Controller.ExecuteCore() +126 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75Comments
Please log in to comment. -
0 comments Created 4 months ago by funky81MySQLxBug in QueryCommand ExecuteScalar() resultAcceptedxThere is bug in ExecuteScalar method in DbDataProvider class. It always gives weird result if the result from cmd.ExecuteScalar() is null. The result is not null nor in some kind of value. I'm using MySQL template and MySQL Connector 6.1.
So I modified the returned value like this
return result != null & !string.IsNullOrEmpty(result.ToString()) ? result : null;
Comments
Please log in to comment. -
Hello,
At the moment types like decimals are being parsed using the current culture by the LINQ parser. This should be done using invariant culture, otherwise you would have to switch to invariant culture before every linq query.
Comments
-
0 comments Created 4 months ago by jswagerSQLitexDifference SQLite DateTime between Insert and new Object()AcceptedxThe SQLite database that I use has a table (call it TEST) with a DateTime field (call it DT). Until recently, I have been inserting records into the table by doing the following:
TEST t = new TEST(); TEST.DT = DateTime.Now; TEST.Save();In SQLite (using SQLiteStudio), this will appear something like this: 2009-09-28 16:29:26.4145701.
Recently, I switched to using a different approach, so that I could control the database connection:
Insert.Into(x => x.DT).Values(DateTime.Now).Execute();This appeared to work - no errors on insert. SQLite showed the value differently, as 9/28/2008 1:23 PM. Unfortunately, this difference becomes apparent when the data gets read; when that happens, an exception about converting strings to datetime is thrown.
Expected behavior?
Comments
Please log in to comment. -
GetPaged needs an index of "1" instead of "0" when using ActiveRecord
0 comments Created 4 months ago by leftendI originally asked a question about this on StackOverflow here: http://stackoverflow.com/questions/1467820/subsonic-getpaged-method-different-index-needed-in-unit-test
Adam thought that this was a bug/inconsistency with the GetPaged method using ActiveRecord, and suggested that I log it here.
Comments
Please log in to comment. -
1 comment Created 4 months ago by fgalgauDb column not read when the column name contains spacesAcceptedxI have a SQLServer and a MySQL database having a few columns containing spaces.
The project is correctly generated using T4 templates, the spaces from column names are removed by CleanUp and the project compiles.
However at runtime those columns containg spaces in their names are not read from the db, by using e.g. myTable.GetAll() or any other method.
The debugger will show a SELECT statement where these columns are not present, meaning there is a bug while generating this statment by Subsonic.Core.
Comments
Please log in to comment.This extends to whenever the name of the Column is changed in any way from that in the database schema (MSSQL confirmed also).
The reason is because by default the system assumes the Property Name is the same as the column name; in fact it conflicts a number of times during query building and during hydration.
I've started a workaround for this which fixes the Selection issue (using the AS keyword for Selection), however haven't got to the Update/Insert issue yet. Not quite comfortable using GIT yet to submit a patch sorry; so here goes:
(PS This may need slight modification for the MySQL overrides etc)== Documented Changes ==
** Structs.tt Find:
<# foreach(var col in tbl.Columns){#>
Columns.Add(new DatabaseColumn("<#=col.Name#>", this) { IsPrimaryKey = <#=col.IsPK.ToString().ToLower()#>, DataType = DbType.<#=col.DbType.ToString()#>, IsNullable = <#=col.IsNullable.ToString().ToLower()#>, AutoIncrement = <#=col.AutoIncrement.ToString().ToLower()#>, IsForeignKey = <#=col.IsForeignKey.ToString().ToLower()#>, MaxLength = <#=col.MaxLength#> });<# }#>
Change to:
<# foreach(var col in tbl.Columns){#>
Columns.Add(new DatabaseColumn("<#=col.Name#>", this) { IsPrimaryKey = <#=col.IsPK.ToString().ToLower()#>, DataType = DbType.<#=col.DbType.ToString()#>, IsNullable = <#=col.IsNullable.ToString().ToLower()#>, AutoIncrement = <#=col.AutoIncrement.ToString().ToLower()#>, IsForeignKey = <#=col.IsForeignKey.ToString().ToLower()#>, MaxLength = <#=col.MaxLength#>, PropertyName = "<#= col.CleanName #>" });<# }#>
** DatabaseTable.cs
Find:
public IColumn GetColumnByPropertyName(string PropertyName) { return Columns.SingleOrDefault(x => x.Name.Equals(PropertyName, StringComparison.InvariantCultureIgnoreCase)); }Change to:
public IColumn GetColumnByPropertyName(string PropertyName) { return Columns.SingleOrDefault(x => x.Name.Equals(PropertyName, StringComparison.InvariantCultureIgnoreCase) || (!String.IsNullOrEmpty(x.PropertyName) && x.PropertyName.Equals(PropertyName, StringComparison.InvariantCultureIgnoreCase))); }** DbExpression.cs
Find:
TableAlias alias; string name; public ColumnExpression(Type type, TableAlias alias, string name) : base(DbExpressionType.Column, type) { this.alias = alias; this.name = name; }Change to:
TableAlias alias; string name; private readonly string memberName; public ColumnExpression(Type type, TableAlias alias, string name) : this(type, alias, name, null) { } public ColumnExpression(Type type, TableAlias alias, string name, string memberName) : base(DbExpressionType.Column, type) { this.alias = alias; this.name = name; this.memberName = memberName; } public string MemberName { get { return this.memberName; } }** TSqlFormatter.cs
Find:
ColumnExpression c = this.VisitValue(column.Expression) as ColumnExpression; if (!string.IsNullOrEmpty(column.Name) && (c == null || c.Name != column.Name)) { sb.Append(" AS "); sb.Append(column.Name); }Change to:
ColumnExpression c = this.VisitValue(column.Expression) as ColumnExpression; if (!string.IsNullOrEmpty(column.Name) && (c == null || c.Name != column.Name)) { sb.Append(" AS "); sb.Append(column.Name); } else if (!String.IsNullOrEmpty(column.Name) && c != null && !String.IsNullOrEmpty(c.MemberName)) { sb.Append(" AS "); sb.Append(c.MemberName); } -
SimpleRepository 'Add<T>' method returns object typed as 'decimal' instead of 'int'
0 comments Created 3 months ago by appakzWhen using the SimpleRepository 'Add' method and passing in an instance of 'T' where the primary key field is an integer (i.e public int PostID {...} in a class named 'Post') the return value is sent back typed as a decimal instead of an int. This appears to be related to how the data reader that reads back the 'SELECT SCOPE_IDENTITY' deals with that type.
I've seen this behavior on two different machines both of which were running against a local installation of SQL Server 2005 Express Edition.
Comments
Please log in to comment. -
1 comment Created 3 months ago by eberttiCreate log file for sql commandPossible for 3.1xin source code have a "#if debug console.writeline ..... " you can made something to enable write in a text file...
this will help a lot!!!
Comments
-
I am using SS 3.0.0.3 ActiveRecord (Current master build) with SQLite. This query:
new Update<BillDetail>(provider) .Set(bd => bd.DivisionDetails == divisionDetails) .Where(bd => bd.BillNumber == documentId && bd.IsInvoice == true);produces this SQL:
UPDATE `BillDetails` SET `DivisionDetails`=@up_DivisionDetails WHERE `BillNumber` = @0Rob informed me here: http://stackoverflow.com/questions/1368405/subsonic-3-updatet-problem that the problem was fixed but it still is not.
Comments
Please log in to comment.In the file Update.cs
Insert the code for correction, in the line 186.
No arquivo update.cs
Na linha 186, corrija com o código abaixo, na linha 186.
internal Setting CreateSetting(IColumn column, bool isExpression) {
Setting s = new Setting { query = this, ColumnName = column.Name, ParameterName = (_provider.ParameterPrefix + "up_" + column.Name), IsExpression = isExpression, DataType = column.DataType }; -
I am using SS 3.0.0.3 ActiveRecord (Current master build) with SQLite (I think this error might be reproducable in other databases also, although I didn't checked).
If I do something like this:
var customerRepo = Customer.GetRepo(); var customerList = customerRepo.GetAll().ToList();And then after making changes to the list, try to do this:
customerRepo.Update(customerList);It causes a SQLite error because if the customer is not changed (i.e. IsDirty flag is false) the sql is not empty but this:
UPDATE `Customers` WHERE `Id` = @0; UPDATE `Customers` WHERE `Id` = @1;If a check for IsDirty flag is added to method public int Update(IEnumerable items, IDataProvider provider) at line 279 of SubSonic.Core\Repository\SubSonicRepository.cs, the error is resolved.
The resultant public int Update(IEnumerable items, IDataProvider provider) method should be:
public int Update(IEnumerable<T> items, IDataProvider provider) { BatchQuery bQuery = new BatchQuery(provider); int result = 0; foreach(T item in items) { if (((IActiveRecord)item).IsDirty()) // adding this check fixes the problem... { var query = item.ToUpdateQuery(provider); bQuery.Queue(query); } } result = bQuery.Execute(); return result; }Comments
Please log in to comment. -
3 comments Created 3 months ago by ApocatastasisSps class fails in simple procedureStored ProcedurexComments
Apocatastasis
Fri Oct 23 10:42:46 -0700 2009
| link
I have a simple sp with one parameter of type int. When I try to fill my dataset with sps.executedataset I got the following error: Implicit conversion from data type sql_variant to int is not allowed. Use the CONVERT function to run this query
Línea 159: DbDataAdapter da = Factory.CreateDataAdapter();
Línea 160: da.SelectCommand = cmd;
Línea 161: da.Fill(ds);
Línea 162:
Línea 163: return ds;Thats seems Subsonic did not recognize the parameter type.
Apocatastasis
Fri Oct 23 10:51:03 -0700 2009
| link
My code is the following:
<DataObjectMethod(DataObjectMethodType.Select, True)> Public Function ObtenerApoyosSolicitados(ByVal idProyecto As Integer) As DataTable
Return SPs.ObtenerApoyosSolicitados(idProyecto).ExecuteDataSet().Tables(0) End FunctionPlease log in to comment.
Apocatastasis
Fri Oct 23 11:30:47 -0700 2009
| link
OK, that's problem of the VB template, wich doesn't generate the parameter type.
-
1 comment Created 3 months ago by eibrahimFind and SingleOrDefault not working in Test ModeAcceptedxI am having a problem while using the test repository and it makes it IMPOSSIBLE to test...
This line of code:
var dbFriend = Friend.SingleOrDefault(f => f.UserId == id && f.FriendId == friendId);Always returns the first element regardless of whether the expression is matched or not. This happens because of
var results=repo.Find(expression);in the ActiveRecord.cs file.
I tried to step through it but couldn't figure it out.
My table looks like this:
FriendUserId - unique, bigint, auto increment
FriendId - big int
UserId - big inI also noticed that the autoincrement features doesn't work in test mode. Is that correct behavior?
Comments
-
0 comments Created 3 months ago by eibrahimTestRepository Update does not workAcceptedxThe update method in the test repository doesn't work. This method:
public int Update(T item) { var update = _items.SingleOrDefault(x => x.KeyValue() == item.KeyValue()); _items.Remove(item); _items.Add(update); return 0; }always sets the variable "update" to null because x.KeyValue() == item.KeyValue() always fail because it is trying to compare two references instead of their values. Even though I have an item with the primary key = 3 it will still return null because it is boxing 3 and comparing two objects instead of two integers (I think!!!)
If I change the method to
public int Update(T item) { var update = _items.SingleOrDefault(x => x.KeyValue().ToString() == item.KeyValue().ToString()); _items.Remove(item); _items.Add(update); return 0; }then the "update" variable is correctly retrieved but the PROBLEM now is
_items.Remove(item)does NOT remove the item from the collection... Not sure why???
I need some help. It is impossible to use the TestRepository in its current state...
Comments
Please log in to comment. -
Schema name missing in update query - ActiveRecord
1 comment Created 3 months ago by uskorcI just started to use subsonic and I have an issue. I only checked it briefly.
When updating an active record object the schema name is missing. If you update the same object or delete it, the schema name is present in the SqlQuery which gets passed to the ANSISqlGenerator.cs. If the table is not under the dbo schema I, of course, get an exception.
In generated Structs.cs file, the schema name is present for the table.
ActiveRecord templates/3.0.0.3/VS08/Win7
Comments
Please log in to comment.
vleschenko
Sun Nov 15 06:48:20 -0800 2009
| link
i have fixed this problem locally. see my patch:
http://www.vitaliy.org/Download/fbf42366-e96a-4165-a6cc-d97a76bca507/Schema.patch
- Accepted▾
- Accepted for 3.1▾
- Fix requires verification▾
- Fixed▾
- Linq Parser▾
- MySQL▾
- Oracle▾
- Possible for 3.1▾
- SQLite▾
- Stored Procedure▾
- T4 Templates▾
- VB.NET▾
- Will close▾
- Workaround Available▾
- adam7▾
- bluefenix▾
- bonder▾
- saintedlama▾
- sphildreth▾
- stimms▾
- Apply to Selection
-
Change Color…
Previewpreview
- Rename…
- Delete




I'm hoping for a patch for this - solving this is over my head at the moment.