Search Results

Search found 72 results on 3 pages for 'subsonic3'.

Page 1/3 | 1 2 3  | Next Page >

  • How to log subsonic3 sql

    - by bastos.sergio
    Hi, I'm starting to develop a new asp.net application based on subsonic3 (for queries) and log4net (for logs) and would like to know how to interface subsonic3 with log4net so that log4net logs the underlying sql used by subsonic. This is what I have so far: public static IEnumerable<arma_ocorrencium> ListArmasOcorrencia() { if (logger.IsInfoEnabled) { logger.Info("ListarArmasOcorrencia: start"); } var db = new BdvdDB(); var select = from p in db.arma_ocorrencia select p; var results = select.ToList<arma_ocorrencium>(); //Execute the query here if (logger.IsInfoEnabled) { // log sql here } if (logger.IsInfoEnabled) { logger.Info("ListarArmasOcorrencia: end"); } return results; }

    Read the article

  • Left Join in Subsonic3

    - by muek
    Hi there, I'm new in subsonic3, and I'm getting some errors when I try to use LeftJoin var q = from c in categories join p in products on c equals p.Category into ps from p in ps.DefaultIfEmpty() select new { Category = c, ProductName = p == null ? "(No products)" : p.ProductName }; The error is "System.Collections.Generic.Enumerable '...' cannot be used for parameter of type System.Linq.IQueryable Does anyone had this error before? Did you fix it? Thanks

    Read the article

  • Help with Subsonic3 ActiveRecord LINQ query

    - by Saif Khan
    I have the following subsonic entities TInvoiceHeader TAccountAssociation How can I achieve the following in LINQ (subsonic) SELECT * from TInvoiceHeader WHERE custid IN (SELECT custid FROM TAccountAssociation WHERE username = 'a') I need to bind the results to a GridView.

    Read the article

  • Help with Subsonic3 LINQ query

    - by Saif Khan
    I have the following subsonic entities TInvoiceHeader TAccountAssociation How can I achieve the following in LINQ SELECT * from TInvoiceHeader WHERE custid IN (SELECT custid FROM TAccountAssociation WHERE username = 'a') I need to bind the results to a GridView.

    Read the article

  • Subsonic3 pre-generate code files

    - by silverfox1948
    I need to pre-generate my active record files, rather than have subsonic build them dynamically. I used to be able to do this using SubSonicCentral in SubSonic 2.x. How do I do this in SubSonic 3? I don't see a generator executable when I download the 3.0.0.4 zip file.

    Read the article

  • Benchmark Linq2SQL, Subsonic2, Subsonic3 - Any other ideas to make them faster ?

    - by Aristos
    I am working with Subsonic 2 more than 3 years now... After Linq appears and then Subsonic 3, I start thinking about moving to the new Linq futures that are connected to sql. I must say that I start move and port my subsonic 2 with SubSonic 3, and very soon I discover that the speed was so slow thats I didn't believe it - and starts all that tests. Then I test Linq2Sql and see also a delay - compare it with Subsonic 2. My question here is, especial for the linq2sql, and the up-coming dotnet version 4, what else can I do to speed it up ? What else on linq2sql settings, or classes, not on this code that I have used for my messures I place here the project that I make the tests, also the screen shots of the results. How I make the tests - and the accurate of my measures. I use only for my question Google chrome, because its difficult for me to show here a lot of other measures that I have done with more complex programs. This is the most simple one, I just measure the Data Read. How can I prove that. I make a simple Thread.Sleep(10 seconds) and see if I see that 10 seconds on Google Chrome Measure, and yes I see it. here are more test with this Sleep thead to see whats actually Chrome gives. 10 seconds delay 100 ms delay Zero delay There is only a small 15ms thats get on messure, is so small compare it with the rest of my tests that I do not care about. So what I measure I measure just the data read via each method - did not count the data or database delay, or any disk read or anything like that. Later on the image with the result I show that no disk activity exist on the measures See this image to see what really I measure and if this is correct Why I chose this kind of test Its simple, it's real, and it's near my real problem that I found the delay of subsonic 3 in real program with real data. Now lets tests the dals Start by see this image I have 4-5 calls on every method, the one after the other. The results are. For a loop of 100 times, ask for 5 Rows, one not exist, approximatively.. Simple adonet:81ms SubSonic 2 :210ms linq2sql :1.70sec linq2sql using CompiledQuery.Compile :239ms Subsonic 3 :15.00sec (wow - extreme slow) The project http://www.planethost.gr/DalSpeedTests.rar Can any one confirm this benchmark, or make any optimizations to help me out ? Other tests Some one publish here this link http://ormbattle.net/ (and then remove it - don not know why) In this page you can find a really useful advanced tests for all, except subsonic 2 and subsonic 3 that I have here ! Optimizing What I really ask here is if some one can now any trick how to optimize the DALs, not by changing the test code, but by changing the code and the settings on each dal. For example... Optimizing Linq2SQL I start search how to optimize Linq2sql and found this article, and maybe more exist. Finally I make the tricks from that page to run, and optimize the code using them all. The speed was near 1.50sec from 1.70.... big improvement, but still slow. Then I found a different way - same idea article, and wow ! the speed is blow up. Using this trick with CompiledQuery.Compile, the time from 1.5sec is now 239ms. Here is the code for the precompiled... Func<DataClassesDataContext, int, IQueryable<Product>> compiledQuery = CompiledQuery.Compile((DataClassesDataContext meta, int IdToFind) => (from myData in meta.Products where myData.ProductID.Equals(IdToFind) select myData)); StringBuilder Test = new StringBuilder(); int[] MiaSeira = { 5, 6, 10, 100, 7 }; using (DataClassesDataContext context = new DataClassesDataContext()) { context.ObjectTrackingEnabled = false; for (int i = 0; i < 100; i++) { foreach (int EnaID in MiaSeira) { var oFindThat2P = compiledQuery(context, EnaID); foreach (Product One in oFindThat2P) { Test.Append("<br />"); Test.Append(One.ProductName); } } } } Optimizing SubSonic 3 and problems I make many performance profiling, and start change the one after the other and the speed is better but still too slow. I post them on subsonic group but they ignore the problem, they say that everything is fast... Here is some capture of my profiling and delay points inside subsonic source code I have end up that subsonic3 make more call on the structure of the database rather than on data itself. Needs to reconsider the hole way of asking for data, and follow the subsonic2 idea if this is possible. Try to make precompile to subsonic 3 like I did in linq2Sql but fail for the moment... Optimizing SubSonic 2 After I discover that subsonic 3 is extreme slow, I start my checks on subsonic 2 - that I have never done before believing that is fast. (and it is) So its come up with some points that can be faster. For example there are many loops like this ones that actually is slow because of string manipulation and compares inside the loop. I must say to you that this code called million of times ! on a period of few minutes ! of data asking from the program. On small amount of tables and small fields maybe this is not a big think for some people, but on large amount of tables, the delay is even more. So I decide and optimize the subsonic 2 by my self, by replacing the string compares, with number compares! Simple. I do that almost on every point that profiler say that is slow. I change also all small points that can be even a little faster, and disable some not so used thinks. The results, 5% faster on NorthWind database, near 20% faster on my database with 250 tables. That is count with 500ms less in 10 seconds process on northwind, 100ms faster on my database on 500ms process time. I do not have captures to show you for that because I have made them with different code, different time, and track them down on paper. Anyway this is my story and my question on all that, what else do you know to make them even faster... For this measures I have use Subsonic 2.2 optimized by me, Subsonic 3.0.0.3 a little optimized by me, and Dot.Net 3.5

    Read the article

  • Using constructor to load data in subsonic3?

    - by Dennis
    I'm getting an error while trying to load an record through the constructor. The constructor is: public Document(Expression<Func<Document,bool>> expression); and i try to load a single item in like this var x = new Document(f=>f.publicationnumber=="xxx"); publicationnumber isn't a key but tried making an it an unique key and still no go.. Am i totally wrong regarding the use of the constructor? and can someone please tell me how to use that constructor? The error i'm getting is: Test method TestProject1.UnitTest1.ParseFileNameTwoProductSingleLanguage threw exception: System.NullReferenceException: with the following stacktrace: SubSonic.Query.SqlQuery.Where[T](Expression1` expression) Load`[T]`(T item, Expression1expression) db.Document..ctor(Expression``1 expression) in C:\@Projects\DocumentsSearchAndAdmin\DocumentsSearchAndAdmin\Generated\ActiveRecord.cs: line 5613 rest removed for simplicity Regards Dennis

    Read the article

  • return distinct records using subsonic 3 query and VB

    - by HR
    I have been having issues trying to return distinct records from a subsonic3 query using VB. My base query looks like so: Dim q As New [Select]("Region") q.From("StoreLocation") q.Where("State").IsEqualTo(ddlState.SelectedValue) q.OrderAsc("Region") This returns duplicates. How can I add a distinct clause in this to return distinct records? I have been trying to place around with Contraints, but to no avail. Thanks in advance HR

    Read the article

  • Adding DataAnnontations to Generated Partial Classes

    - by Naz
    Hi I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class. I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this. public partial class User { [DataType(DataType.EmailAddress, ErrorMessage = "Please enter an email address")] public string Email { get; set; } ... } That examples gives the "Member is already defined" error. I think I might have seen an example a while ago of what I'm trying to do with Dynamic Data and Linq2Sql.

    Read the article

  • LINQ, "Argument types do not match" error, what does it mean, how do I address it?

    - by Biff MaGriff
    Hello, I'm new to linq and I'm trying to databind to an anonymous type. I'm using SubSonic 3.0 as my DAL. I'm doing a select from 2 tables like so var myDeal = (from u in db.Users select new { UserID = u.UserID, UserRoleID = (from ur in u.UserRoles where u.UserRoleID == ur.UserRoleID select ur).FirstOrDefault().UserRoleID }); foreach (var v in myDeal) //dies first time here { } Then when I databind or try to iterate through the collection I get the "Argument types do not match" error during run time. I'm not sure what is going on here.

    Read the article

  • Subsonic 3 LINQ vs LINQ to SQL

    - by Jamil
    Hi, I am using SQL Server 2005 in a project. I have to decide about datalayer. I would like to use LINQ in my project. I saw SubSonic 3 supporting LINQ and I also have option for LINQ to SQL, because i can have typed lists from LINQ to SQL. I am wondering what is different between LINQ to SQL and Subsoinc 3 LINQ, Which is beneficial? Thanks! JAMIL

    Read the article

  • SUBSONIC 3.0.0.3 Subsonic.Query.SqlQuery

    - by dancingn27
    New to subsonic and having issues figuring it out. I am simply just trying to do a distinct search and any documentation I find is telling me to use the class/method SubSonic.SqlQuery Though I am finding out that since I am using the newest version, a lot of the documentation I am finding does not apply. For example, I am getting this query working beautifully using Subsonic.Query.SqlQuery though there is NO distinct method hanging off of it as suggested by what I have seen. Please advice! SubSonic.Query.SqlQuery query = brickDB.SelectColumns(new string[] { "DomainName" }).From<Web.Data.DB.WebLog>() .Where(Web.Data.DB.WebLogTable.DomainNameColumn).IsNotNull(); -> No distinct hanging off of From<>()....

    Read the article

  • SubSonic Stored Procedure Issue - Data Generated at Stored Procedure is different from Data Received

    - by ShaShaIn
    Hi All, I am facing a unknown problem while using stored procedure with SubSonic. I have written a stored procedure & application code that takes first name & last name as input parameter and return last login id as ouput parameter. It creates login id as first character of first name & complete last name for no-existing login id otherwise it adds 1 in the last login id e.g. First Name - Mark, Last Name - Waugh, First Login Id - MWaugh, Second Login Id - MWaugh1, Third Login Id - MWaugh2 etc. Stored Procedure SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[Users_FetchLoginId] ( @FirstName nvarchar(64), @LastName nvarchar(64), @LoginId nvarchar(256) OUTPUT ) AS DECLARE @UserId nvarchar(256); SET @UserId = NULL; SET @LoginId = NULL; SELECT @UserId = LoweredUserName FROM aspnet_Users WHERE LoweredUserName LIKE (LOWER(SUBSTRING(@FirstName,1,1) + @LastName)) IF @@rowcount = 0 OR @UserId IS NULL BEGIN SET @LoginId = (SUBSTRING(@FirstName, 1, 1) + @LastName); print @LoginId RETURN 1; END ELSE BEGIN SELECT TOP 1 LoweredUserName FROM aspnet_Users WHERE LoweredUserName LIKE (LOWER(SUBSTRING(@FirstName,1,1) + @LastName + '%')) ORDER BY LoweredUserName DESC RETURN 2; END Application Code public string FetchLoginId(string firstName, string lastName) { SubSonic.StoredProcedure sp = SPs.UsersFetchLoginId( firstName, lastName, null ); sp.Command.AddReturnParameter(); sp.Execute(); if (sp.Command.Parameters.Find(delegate(QueryParameter queryParameter) { return queryParameter.Mode == ParameterDirection.ReturnValue; }).ParameterValue != System.DBNull.Value) { int returnCode = Convert.ToInt32(sp.Command.Parameters.Find(delegate(QueryParameter queryParameter) { return queryParameter.Mode == ParameterDirection.ReturnValue; }).ParameterValue, CultureInfo.InvariantCulture); if (returnCode == 1) { // UserName as First Character of First Name & Full Last Name return sp.Command.Parameters[2].ParameterValue.ToString(); } if (returnCode == 2) { DataSet ds = sp.GetDataSet(); if (null == ds || null == ds.Tables[0] || 0 == ds.Tables[0].Rows.Count) return ""; string maxLoginId = ds.Tables[0].Rows[0]["LoweredUserName"].ToString(); string initialLoginId = firstName.Substring(0, 1) + lastName; int maxLoginIdIndex = 0; int initialLoginIdLength = initialLoginId.Length; if (maxLoginId.Substring(initialLoginIdLength).Length == 0) { maxLoginIdIndex++; // UserName as Max Lowered User Name Found & Incrementer as Suffix (Here, First Incrementer i.e. 1) return (initialLoginId + maxLoginIdIndex); } if (int.TryParse(maxLoginId.Substring(initialLoginIdLength), out maxLoginIdIndex)) { if (maxLoginIdIndex > 0) { maxLoginIdIndex++; // UserName as Max Lowered User Name Found & Incrementer as Suffix return (initialLoginId + maxLoginIdIndex); } } } } Now the problem is for some input (see test data below), the login id created at sql server end correctly but at application subsonic dal side, it truncates some characters. First Name - Jenelia and Last Name - Kanupatikenalaalayampentyalavelugoplansubhramanayam [dbo].[Users_FetchLoginId] - Execute Stored Procedure Separately - Login Id Is Correct JKanupatikenalaalayampentyalavelugoplansubhramanayam public string FetchLoginId(string firstName, string lastName) - Application Code DAL Side - LginId Is Wrongly Received From Stored Procedure JKanupatikenalaalayampentyalavelugoplansubhramanay You can easily see that 2 charactes are removed. If the data is correctly generated by stored procedure then why the characters are removed when data is received in output parameter of stored procedure? Is it due to any internal known or unknown bug of SubSonic? Your help is significant. Thanks in advance...

    Read the article

  • SubSonic 3.0.0.3 | Data Access Layer - Audit trails

    - by No Body
    Hi guys how do you implementing an Audit Trails on all objects/class on SubSonic under Data Access Layer? If what I want is, all changes on all objects will be recorded on a single table/object. public class AuditTrail { public int Id { get; set; } public string SourceObjectName { get; set; } public int RowPK { get; set; } // Id of the SourceObject public string ChangeType {get; set;} // value such as "Add", "Update", "Delete" public string RowCapture { get; set; } // Id="6" UserId="xxx3" SurName="NoBodyx" FirstName="no3" MiddleName="B." Email="[email protected]" CreatedDate="8/6/2009 1:57:58 PM" CreatedBy="ca3" UpdatedDate="8/7/2009 5:58:37 AM" UpdatedBy="qqq" Name="no3 B. NoBodyx" public CreatedDate {get; set;} }

    Read the article

  • Subsonic 3, MySql, won't update record.

    - by Warspawn
    [WebMethod] public string GetAuthToken(string username, string password) { var db = new LogicDB(); //var results = from u in db.Users // where u.Username == username && u.Password == password // select u; User u = db.Select .From<User>() .Where(UsersTable.UsernameColumn).IsEqualTo(username) .And(UsersTable.PasswordColumn).IsEqualTo(password) .ExecuteSingle<User>(); if (u == null) { return "{'success': false, 'reason': 'Invalid username and/or password.'}"; } else { // really there should only be one match... Guid code = Guid.NewGuid(); u.Securitycode = code.ToString(); u.Securityexp = System.DateTime.Now.AddHours(24); //u.Save(db.Provider); return "{'id':'" + u.Id.ToString() + "', 'code':'" + code.ToString() + "', 'exp':'" + u.Securityexp.ToString() + "'}" + "\n\n<br/><br/>" + u.GetDirtyColumns().ToArray().ToString(); } } When I run that, I keep getting: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. This is when u.Save(db.Provider); is uncommented. And happens even with just u.Save(); or using the linq query above results instead.

    Read the article

  • Saving record in Subsonic 3 using Active Record

    - by singfoom
    I'm having trouble saving a record in Subsonic 3 using Active record. I've generated my objects using the DALs and tts and everything seems fine because the following test passes. I think that my connection string is correct or the generation wouldn't have succeeded. [Test] public void TestSavingAnEmail() { Email testEmail = new Email(); testEmail.EmailAddress = "[email protected]"; testEmail.Subscribed = true; testEmail.Save(); Assert.AreEqual(1, Email.All().Count()); } On the live side, the following code fails: protected void btEmailSubmit_Click(object sender, EventArgs e) { Email email = new Email(); email.EmailAddress = txtEmail.Text; email.Subscribed = chkSubscribe.Checked; email.Save(); } with a message of: Need to specify Values or a Select query to insert - can't go on! at the following line repo.Add(this,provider); line in my ActiveRecord.cs: public void Add(IDataProvider provider){ var key=KeyValue(); if(key==null){ var newKey=_repo.Add(this,provider); this.SetKeyValue(newKey); }else{ _repo.Add(this,provider); } SetIsNew(false); OnSaved(); } Am I doing something horribly wrong here? The save and add methods have parameterless overloads that I thought were safe to use. Do I need to pass a provider? I've googled around for this for a while and was unable to come up with anything specific to my situation. Thanks in advance for any kind of answer.

    Read the article

  • Subsonic 3 fails to identify Stored Procedure Output Parameter

    - by CmdrTallen
    Hi using Subsonic 3.0.0.3 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 type I 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. EDIT: I forgot to mention I am using MS SQL 2008 (10.0.2531)

    Read the article

  • SubSonic 3 ignoring columns in Select()

    - by jessegavin
    I have a table like so.. CREATE TABLE [dbo].[Locations_Hours]( [LocationID] [int] NOT NULL, [sun_open] [nvarchar](10) NULL, [sun_close] [nvarchar](10) NULL, [mon_open] [nvarchar](10) NULL, [mon_close] [nvarchar](10) NULL, [tue_open] [nvarchar](10) NULL, [tue_close] [nvarchar](10) NULL, [wed_open] [nvarchar](10) NULL, [wed_close] [nvarchar](10) NULL, [thu_open] [nvarchar](10) NULL, [thu_close] [nvarchar](10) NULL, [fri_open] [nvarchar](10) NULL, [fri_close] [nvarchar](10) NULL, [sat_open] [nvarchar](10) NULL, [sat_close] [nvarchar](10) NULL, [StoreNumber] [int] NULL, [LocationHourID] [int] IDENTITY(1,1) NOT NULL, CONSTRAINT [PK_Locations_Hours] PRIMARY KEY CLUSTERED ( [LocationHourID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] And SubSonic 3 is generating a class with the following properties int LocationID string monopen string monclose string tueopen string tueclose string wedopen string wedclose string thuopen string thuclose string friopen string friclose string satopen string satclose string sunopen string sunclose int? StoreNumber int LocationHourID When I try to perform a query against this class like so.. var result = DB.LocationHours.Where(o => o.LocationID == _locationId); This is the resulting SQL query that SubSonic generates. SELECT [t0].[LocationHourID], [t0].[LocationID], [t0].[StoreNumber] FROM [dbo].[Locations_Hours] AS t0 WHERE ([t0].[LocationID] = 4019) I cannot figure out why SubSonic is omitting the nvarchar fields when it generates the SELECT statement. Anyone got any ideas?

    Read the article

  • Subsonic 3.0.0.4 Does not Update

    - by geocine
    I tried 3 variants but doesn't seem to update (I am using Linq Templates and MSSQL) Luna.Data.GameDBDB db = new Luna.Data.GameDBDB(); db.Update<Luna.Record.TB_ITEM>() .Set(x => x.ITEM_DURABILITY == Convert.ToInt32(quantity)) .Where(x => x.ITEM_DBIDX == Convert.ToInt32(dbdidx)) .Execute(); Here is the other one var db = new Luna.Data.GameDBDB(); var query = (from p in db.TB_ITEMS where p.ITEM_DBIDX == Convert.ToInt32(dbidx) select p).Single(); query.ITEM_DURABILITY = Convert.ToInt32(quantity); db.tp TP_ITEM_UPDATE(); and the other one var db = new Luna.Data.GameDBDB(); var query = (from p in db.TB_ITEMS where p.ITEM_DBIDX == Convert.ToInt32(dbidx) select p).Single(); query.ITEM_DURABILITY = Convert.ToInt32(quantity); db.Update<Luna.Data.TB_ITEM>(); However it worked using LINQ-to-SQL LunaDataContext db = new LunaDataContext(); var query = (from p in db.TB_ITEMs where p.ITEM_DBIDX == Convert.ToInt32(dbidx) select p).Single(); query.ITEM_DURABILITY = Convert.ToInt32(quantity); db.SubmitChanges(); Is this a bug in 3.0.0.4, the database record couldn't be updated using Linq Templates and ActiveRecord.

    Read the article

  • Dynamic Data with Subsonic 3

    - by Ezequiel Bertti
    i want to make a webproject with Subsonic and Dynamic Data... But when i go register the ContextData a don't have it in subsonic with LINQ... in Global.asax.cs a have to do something like this model.RegisterContext(SubSonicRepo, new ContextConfiguration() { ScaffoldAllTables = true }); how can i make it work? have some way to make it work? using entities or LINQ everything work... but using Subsonic with linq it not work...

    Read the article

  • Subsonic 3.0 Query limit with MySQL c#.net LinQ

    - by omegawkd
    Hello, a quick question which may or may not be easily answered. Currently, in order to return a limited result set of data to my calling reference using SubSonic I use a similar function as below: _DataSet = from CatSet in t2_aspnet_shopping_item_category.All() join CatProdAssignedLink in t2_aspnet_shopping_link_categoryproduct.All() on CatSet.CategoryID equals CatProdAssignedLink.CategoryID join ProdSet in t2_aspnet_shopping_item_product.All() on CatProdAssignedLink.ProductID equals ProdSet.ProductID where ProdSet.ProductID == __ProductID orderby CatProdAssignedLink.LinkID ascending select CatSet; and select the first item from the data set. Is there a way to limit the lookup initially to a certain amount of rows? I'm using MySQL as the base database.

    Read the article

  • Failed to resolve include text for file:SQLServer.ttinclude

    - by bigred
    I updated to the version 3.0.0.3. Dragged the new ActiveRecord directory in VS08, and added the newer dll. I'm not sure whats going on yet. When I try to compile the project I get that error. My SVN server just lost my old version, so I'll have to download the older Subsonic version and see if that fixes the problem. I have no clue what I did wrong in the configuration as I updated to 3.0.0.3. (still a new users so I couldn't post a photo, but here a link to the error) link text

    Read the article

  • Atomically increment a field using SubSonic 3 ActiveRecord.

    - by cantabilesoftware
    I'm tring to increment a field in a MySQL database using SubSonic 3 ActiveRecord. In SQL, this is what I'm after: UPDATE people SET messages_received=messages_received+1 WHERE people_id=@id_to; I tried the following, but it didn't seem to work (messages_received always seemed to be 1): _db.Update<person>() .Set("messages_received").EqualTo(x => x.messages_received == x.messages_received + 1) .Where(x => x.people_id == idTo) .Execute(); This did work: string sql="UPDATE people SET messages_received=messages_received+1 WHERE people_id=@id_to"; var q=new SubSonic.Query.QueryCommand(sql, _db.Provider); q.AddParameter("id_to", idTo); q.Provider.ExecuteQuery(q); So I have a solution, but I'm just wondering if it's possible to do this without resorting to plain SQL?

    Read the article

  • Subsonic 3 Simple Repository And Transactions

    - by ChrisKolenko
    Hey everyone, So this is what I have so far. Am I doing something wrong or is there a bug in 3.0.0.3? var Repository = new SimpleRepository("DBConnectionName"); using (TransactionScope ts = new TransactionScope()) { using (SharedDbConnectionScope scs = new SharedDbConnectionScope("connstring", "providerName")) { try { for (int i = 0; i < 5; i++) { Supplier s = new Supplier(); s.SupplierCode = i.ToString(); s.SupplierName = i.ToString(); Repository.Add<Supplier>(s); } ts.Complete(); } catch { } } } I'm getting an error in SubSonic DbDataProvider public DbConnection CurrentSharedConnection { get { return __sharedConnection; } protected set { if(value == null) { __sharedConnection.Dispose(); etc.. __sharedConnection == null :( Object Null Reference Exception :(

    Read the article

  • Subsonic 3, SimpleRepository, SQL Server: How to find rows with a null field?

    - by desautelsj
    How ca I use Subsonic's Find<T> method to search for rows with a field containing the "null" value. For the sake of the discussion, let's assume I have a c# class called "Visit" which contains a nullable DateTime field called "SynchronizedOn" and also let's assume that the Subsonic migration has created the corresponding "Visits" table and the "SynchronizedOn" field. If I was to write the SQL query myself, I would write something like: SELECT * FROM Visits WHERE SynchronizedOn IS NULL When I use the following code: var visits = myRepository.Find<Visit>(x => x.SynchronizedOn == null); Subsonic turns it into the following SQL query: SELECT * FROM Visits WHERE SynchronizedOn == null which never returns any rows. I tried the following code but it throws an error: visits = repository.Find<Visit>(x => x.SynchronizedOn.HasValue); I was able to use the following syntax: var query = from v in repository.All<Visit>() where v.SynchronizedOn == null orderby v.CreatedOn select v; visits = query.ToList<Visit>(); but it's not as nice an short as using the Find<T> method. Anyone knows how I can specify the "SynchronizedOn IS NULL" condition in the Find<T> method?

    Read the article

1 2 3  | Next Page >