Search Results

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

Page 3/3 | < Previous Page | 1 2 3 

  • Subsonic 3 : get only certain columns

    - by CTGA
    Hello, I use : Subsonic 3, SQL Server 2008, Json.Net Here is my problem : I have a house table with id,lot number, address, location, ownerid and an owner table with id,name, description. I'd like to get only the owner name and address of house where location is "San Francisco". How can I do this with Subsonic? My problem is I can only get a typed list or a datareader, I don't understand how to only get an array or a simple list. What is the best solution? Create a custom class ? Create a View ? Anything else ? My aim is to then serialize the data to send it back to my application, but serialization is seriously long because of the numerous relationships (My example here is simplified, there are indeed : house - owner - city - country etc.), whereas I need only 2 fields... Thank you

    Read the article

  • Atomically maintaining a counter using Sub-sonic ActiveRecord

    - by cantabilesoftware
    I'm trying to figure out the correct way to atomically increment a counter in one table and use that incremented value as an pseudo display-only ID for a record in another. What I have is a companies table and a jobs table. I want each company to have it's own set of job_numbers. I do have an auto increment job_id, but those numbers are shared across all companies. ie: the job numbers should generally increment without gaps for each company. ie: companies(company_id, next_job_number) jobs(company_id, job_id, job_number) Currently I'm doing this (as a method on the partial job class): public void SaveJob() { using (var scope = new System.Transactions.TransactionScope()) { if (job_id == 0) { _db.Update<company>() .SetExpression("next_job_number").EqualTo("next_job_number+1") .Where<company>(x => x.company_id == company_id) .Execute(); company c = _db.companies.SingleOrDefault(x => x.company_id == company_id); job_number = c.next_job_number; } // Save the job this.Save(); scope.Complete(); } } It seems to work, but I'm not sure if there are pitfalls here? It just feels wrong, but I'm not sure how else to do it. Any advice appreciated.

    Read the article

  • calculate distance with linq or subsonic

    - by minus4
    i have this MySQL statement from a search page, the user enters there postcode and it finds the nearest stiocklist within 15 MIles of the entered postcode. SELECT * , ( ( ACOS( SIN( "+SENTLNG +" * PI( ) /180 ) * SIN( s_lat * PI( ) /180 ) + COS( " + SENTLNG +" * PI( ) /180 ) * COS( s_lat * PI( ) /180 ) * COS( ( " + SENTLANG + " - s_lng ) * PI( ) /180 ) ) *180 / PI( ) ) *60 * 1.1515 ) AS distance_miles FROM new_stockists WHERE s_lat IS NOT NULL HAVING distance_miles <15 ORDER BY distance_miles ASC LIMIT 0 , 15 but now i am using linq and subsonic and not got a clue how do do this in linq or subsonic your help would be much appreciated, please also not that i have to sent in a dynamic from address, thats the postcode mentioned at the top of the page, i do a call to google to get then lng and lat from them for the postcode given.

    Read the article

  • Using Subsonic 3.0 Advanced Templates

    - by umit
    Hi all, I've been trying to use Subsonic Advanced Templates in a project for a while but most of the time I find myself writing a Stored Procedure as I can't find a proper way of doing it in code. Subsonic created corresponding objects for my DB tables and for foreign keys it created IQueryable fields inside each object. These fields are not loaded by default and a new SQL query is executed when you access them. 1- Is there a way to get all data in one query (deep load)? Also these fields can not be assigned. So when I want to create an object in a maintenance page, I can't put all the data into this object before saving it in DB: Post post = new Post(); //get photos for this post IList<PostPhoto> postPhotos = GetPostPhotos(); post.PostPhotos = postPhotos; 2- Is it possible to have one Post object with all fields set from user input? Think of the Post object above and assume I've successfully assigned its fields. Now I need to save it to the DB. 3- Is using BatchQuery the only way to do it in one query? If I have 4 photos in PostPhotos field; 2 of them previously saved and 2 of them new, can I use the Update method to handle both the adding and updating of these photos? Any ideas or links are appreciated. Cheers...

    Read the article

  • Object mapping with LINQ and SubSonic

    - by Jeremy Seekamp
    I'm building a small project with SubSonic 3.0.0.3 ActiveRecord and I'm running into an issue I can't seem to get past. Here is the LINQ query: var result = from r in Release.All() let i = Install.All().Count(x => x.ReleaseId == r.Id) where r.ProductId == productId select new ReleaseInfo { NumberOfInstalls = i, Release = new Release { Id = r.Id, ProductId = r.ProductId, ReleaseNumber = r.ReleaseNumber, RevisionNumber = r.RevisionNumber, ReleaseDate = r.ReleaseDate, ReleasedBy = r.ReleasedBy } }; The ReleaseInfo object is a custom class and looks like this: public class ReleaseInfo { public Release Release { get; set; } public int NumberOfInstalls { get; set; } } Release and Install are classes generated by SubSonic. When I do a watch on result, the Release property is null. If I make this a simpler query and watch result, the value is not null. var result = from r in Release.All() let i = Install.All().Count(x => x.ReleaseId == r.Id) where r.ProductId == productId select new Release { Id = r.Id, ProductId = r.ProductId, ReleaseNumber = r.ReleaseNumber, RevisionNumber = r.RevisionNumber, ReleaseDate = r.ReleaseDate, ReleasedBy = r.ReleasedBy }; Is this an issue with my LINQ query or a limitation of SubSonic?

    Read the article

  • N Tiers with SubSonic 3, Dirty Columns collection is alwayes empty on update

    - by Adel
    Hello guys here is what i am doing, and not working for me. I have a DAL generated with SubSonic 3 ActiveRecord template, i have a service layer (business layer if you well) that have mixture of facade and some validation. say i have a method on the Service layer like public void UpdateClient(Client client); in my GUI i create a Client object fill it with some data with ID and pass it to the service method and this never worked, the dirty columns collection (that track which columns are altered in order to use more efficant update statment) is alwayes empty. if i tried to get the object from database inside my GUI then pass it to the service method it's not working either. the only scenario i find working is if i query the object from the database and call Update() on the same context all inside my GUI and this defeats the whole service layer i've created. however for insert and delete everything working fine, i wonder if this have to do something with object tracking but what i know is SubSonic don't do that. please advice. thanks. Adel.

    Read the article

  • SubSonic 3 LeftOuterJoin

    - by michaelpearce
    I have read in this forum that left outer join syntax is not supported by subsonic in an answer to a question on the topic by "Apocatastasis". I have the same issue in that when I create a query using the .LeftOuterJoin the resulting sql has an inner join rather than a left outer join. Can someone please confirm that LeftOuterJoin is indeed not supported and, if that is the case, why is it included in the active record syntax? Thanks Michael

    Read the article

  • Not getting key value from Identity column back after inserting new row with SubSonic ActiveRecord

    - by mikedevenney
    I'm sure I'm missing the obvious answer here, but could use a hand. I'm new to SubSonic and using version 3. I've got myself to the point of being able to query and insert, but I'm stuck with how I would get the value of the identity column back after my insert. I saw another post that mentioned Linq Templates. I'm not using those (at least I don't think I am...?) TIA ... UPDATE ... So I've been debugging through my code watching how the SubSonic code works and I found where the indentity column is being ignored. I use int as the datatype for my ID columns in the database and set them as identity. Since int is a non-nullable data type in c# the logical test in the Add method (public void Add(IDataProvider provider)) that checks if there is a value in the key column by doing a (key==null) could be the issue. The code that gets the new value for the identity field is in the 'true path', since an int can't be null and I use ints as my identity column data types this test will never pass. The ID field for my object has a 0 in it that I didn't put there. I assume it's set during the initialization of the object. Am I off base here? Is the answer to change my data types in the database? Another question (more a curiosity). I noticed that some of the properties in the generated classes are declared with a ? after the datatype. I'm not familiar with this declaration construct... what gives? There are some declared as an int (non key fields) and others that are declared as int? (key fields). Does this have something to do with how they're treated at initialization? Any help is appreciated! --BUMP--

    Read the article

  • SubSonic LInq IRepository

    - by ajwaka
    Trying to use SubSonic 3.0.0.4's Linq TEmplates. Got everything working. But in the Doc's I'm seeing how I can use aa IRepository to bulk insert, update, delete my db. Thing is - It wasn't included in the download. Is it somewhere else and I simply overlooked it? I've got a ton of updates going from one "Save" call - so this would be very helpful! Thanks

    Read the article

  • Using Subsonic 3.0 With Silverligh

    - by Craig
    I am writing a silverlight Line of business application and wanted to use the Subsonic DAL. The Silverlight Project will not allow me to Add the Subsonic reference with the followng error "You can not add the Subsonic.Core.Dll as it was not built against the Silverlight Runtime". I assume that I could create a webservice and add the Subsonic to that, but I would like to just add it to the Silverlight Project. Has anyone done this and if so how. If not is there an easy way to expose the DAL through the Webservice.

    Read the article

  • Subsonic 3.0 select Query using DateColumn

    - by vineth
    Hi , While selecting records using Date-Field i am facing a problem , my SQL2005 View (ViewOrders) StarDate column Have 4/23/2010 12:00:00 AM 4/23/2010 12:00:00 AM 4/23/2010 12:00:00 AM 4/23/2010 12:00:00 AM 4/23/2010 1:07:00 PM My Code using subsonic 3.0 AMDB ctx = new AMDB(); SqlQuery vwOrd = ctx.Select.From(); vwOrd = vwOrd.And("StartDate").IsGreaterThanOrEqualTo("04/22/2010");//From date vwOrd = vwOrd.And("StartDate").IsLessThanOrEqualTo("04/22/2010");// To Date List cat = vwOrd.ToList(); i can able to fetch only first four records, i can't able to fetch the final record which start date contains(4/23/2010 1:07:00 PM). I think the problem is in the time format.. How can i code in subsonic ,which compare only the date in the date-time column. I Don't need date "Between" method in subsonic, since i can get single date parameter(From date alone). how can i solve this problem. Thnks in advance

    Read the article

  • Updating my database

    - by Malcolm
    I am new with the subsonic, and I have a problem when trying to update the database from the sql server. I have created a gridview by still is not returning the updates results. can you please help me? its getting an error code on dc.AddMostaHse(); (Cannot implicity convert type 'void to 'object') Here is the code being done of DataAccess.cs page public void AddMostaHse() { Mosta.MostaHSE1 xx = new MostaHSE1(); xx.ID = 94; xx.FunctionLocation = "lza94"; xx.acno = 12; xx.Save(); } Binding it with the gridview. { DataAccess dc = new DataAccess(); gvtest.DataSource = dc.AddMostaHse(); gvtest.DataBind(); }

    Read the article

  • SubSonic 3 issue creating List<>

    - by Brian Cochran
    I have an application that requires we use distinct user connection strings per user. We are trying to upgrade from SubSonic 2.x to 3.0. I'm running into issues with trying to create a List< of objects. When I try to create a List like this: List<table_name> oList = table_name.All().Where(tn => tn.table_id == TableId).ToList(); I get the error "Connection string 'ConnectionStringName' does not exist." So, I try to create the List< like this: List<table_name> oList = table_name.All(sConnectionString, "System.Data.SqlClient").Where(tn => tn.table_id == TableId).ToList(); I get the error "The name 'table_name' does not exist in the current context." I'm using SQL Server, and the sConnectionString is definitely verified to be a good connection string, and the table_name is a table in the database. What am I doing wrong?

    Read the article

  • Subconic3.0 with winform app

    - by Saif Khan
    Can subsonic 3.0 be used with a winform app? Do I need to add any references to the system.web? If it can be done, how can I exclude certain tables in the DB? Can I use the following whih I am using for subsonic 2.0 <providers> <!--<clear/>--> <add name="TEST" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="myString" includeTableList="CustomerReference" includeProcedureList=""/> </providers>

    Read the article

  • Where is SubSonicCentral for SubSonic 3.0

    - by silverfox1948
    I used subsoniccentral for pre-building my access code using SubSonic 2.x. My site works in medium trust. I'd like to upgrade to 3.0, but when downloading the binaries and the source, I don't see anything related to subsoniccentral. Is it now deprecated? Or can I just use the old one with the new binaries?

    Read the article

  • Subsonic 3.0 - .Net - Error : Can not ceate an instance of an interface

    - by George
    Hi, I am new to Subsonic, I have configured Subsonic3.0 T4 Template and created classes for my project. I have taken GridView and Object Datasource. Object datasource will connect to the one of the classes which is created from subsonic. I have set object datasource for g\fetch, Insert, Update and delete methods. Then i set the datasource of grid witht he object datasource. Grid view successfully showing me all the records. But at the time of Update, Insert or delete it throws an exception that "Can not ceate an instance of an interface". And also i am not able to dwbug in the code of the subsonic. May be because of partial classes. Can anyone please let me know what is happening at the backgrund? Or may be one can give me sample example which contains subsonic 3.0 and grid add, edit and delete so it will be really helpful for me.... Please... :) Thanks, George

    Read the article

< Previous Page | 1 2 3