Using Subsonic 2.2 latest SVN.
SQL Server 2008 table has a column called Accreditation
The Subsonic generated property for this column is named AccreditationX
Can anybody tell me why ?
Going to guess it's the same name as your table...
Related
As the title suggest, I was wondering if it was possible to use any other column name for the index than id?
The documentation for creating a Mobile Backend in Azure and Xamarin Forms app stipulates that the index column must be id all lower case for the API to return data. What if your index column is called something else, for example idx_index.
My issue is that my database already exists and there are a lot of tables. I'd like to avoid having to rename the index columns in the database if I can.
Is there anything I can do that would help me avoid this problem or does it look like I'll need to rename my columns to id?
No - you cannot use any other name other than id. This is in-built into the SDK and you would need to alter both the server and client SDKs (and compile new ones) to support something else. This is a non-trivial update.
Since my database already existed all the column naming was set. To get around this problem when it came to Azure and it's expectation of a column called id I simply cast the column names in some custom views which were specific to my mobile app. For example:
SELECT index_idx as id,
name,
location
FROM mytable
Here is the case:
I have an SQL Database table that I want to migrate to a Dynamic CRM 4.0 database. There is a table (let's call it Table_A ) that have a particular column (Table_A.Type). I want to migrate the table A data into either the Account entities or Contact entities in Dynamic depending on the Table_A.Type. If the Type is 0, I'll put it into Contact, else if the Type is 1, I'll put it into Account.
How can I do this using the Scribe Workbench?
The problem already solved. I use formula to put a condition in the migration flow.
This doesn't make much sense to me. We had this happen twice recently when generating SubSonic objects for a database table or view columns got renamed to ColumnX. The first time it made sense because the column name is Value, a C# keyword. But the second time it happened, the table's column name is Grade, which is not a keyword or reserved word. Does anyone know why SubSonic turns this column name into GradeX when it generates objects?
Thanks.
It is, like you assumed, to replace words so they don't conflict with .Net or SQL types. Don't forget SubSonic talks to various db providers so although "Grade" isn't a MSSQL type it's possible it's an Oracle or MySQL etc...
Under SubSonic.Utilities.Utility is a method named KeyWordCheck which does the appending.
Perhaps you can compile your own version and amend this method to exclude "Grade":
public static string KeyWordCheck(string word, string table, DataProvider provider)
{
string appendWith = "X";
if (provider.AppendWith != string.Empty)
appendWith = provider.AppendWith;
return KeyWordCheck(word, table, appendWith);
}
I want to know that How to Insert New Columns to an existing database Table using Subsonic 3.0.0.5 MIGRATIONS.
Basically I want to alter an existing table in MS SqlServer database and add three more columns into it.
Please tell me How I will be able to do it
Regards,
Naveed Khan
Just change your object and the column will be added/updated whatever. So if you have an object called "Post" and add a property, it will be added as a column in the DB.
See this video...
http://subsonicproject.com/docs/Simple_Repo_5_Minute_Demo
It has to do with the conventions of SubSonic.
As the object is singular, it adds the plural to the table (or expects the table to be plural).
So it will expect an object called Order to map to a table called Orders.
There is only two solutions that I can see for you
1) Rename you table to the plural name.
2) Modify Subsonic code to remove the adding of the plural.
I have a table with a PrimaryKey that is set as uniqueidentifier (GUID) and it's autopopulated using the newsequentialid() function from sql server 2008... When I insert a row manually, everything works as normal. But when I insert the record using the subsonic class and the repository the GUID column defaults to all zero's and the database will enter that value. I need it to NOT do this and use the default value of the column... anyone else able to get around this issue?
This was fixed in 2.0.2 for SQL 2005 - I'm wondering if there's an issue with SQL 2008. What version are you using? I'm thinking this might not have been covered in 3.x just yet.