How to add additional tables in DashCommerce 2 using SubSonic 2.0.3 - subsonic

I've inherited an website that is base on
DashCommerce 2
SubSonic 2.0.3
I wish to add some customfields to the project however cannot find .tt files. Also there is not option to "run tool"
Did SubSonic 2.0.3 use .tt files? I'm assuming .tt = t4?
I don't seen any active record .dll's in the bin.

Ok, so I need to use subcommander to generate this files. Rob's made a nice screencast
This has created new issues as i can't seem to install subsonic tools 2.03 from here
i'm Win7 , VS2008
Does anyone have the 2.03 sonic.exe?
Also, i see dashcommerce has 3 generated directories
Controllers
Models
Utilies
I'm not sure how to generated these different kinds of classes.

Related

Duplicate files in DerivedData folder using CoreData generator

I'm trying to generate NSManagedModels from my datamodel. Generation works but after I got many errors :
error: filename "Station+CoreDataProperties.swift" used twice:
'/Users/Me/MyApp/Models/CoreData/Station+CoreDataProperties.swift' and
'/Users/Me/Library/Developer/Xcode/DerivedData/MyApp-gwacspwrsnabomertjnqfbuhjvwc/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/DerivedSources/CoreDataGenerated/Model/Station+CoreDataProperties.swift'
:0: note: filenames are used to distinguish private
declarations with the same name
I try clean build folder and derivedData directory hard delete. I'm using Xcode 8 BETA maybe it's a bug ?
I get this in Xcode 8.1
For me following steps solved the issue. Please note that order matters.
1) Create entity in Core Data model.
2) Under class section, make settings as on following image.
Module: Current Product Name
Codegen: Manual/None
3) Generate your NSManagedObject subclass.
This post greatly helped me solve this problem myself. Personally I look at this as an Xcode bug. Bug or not this is a huge chicken and egg situation.
I ran into this by:
Created a new Project using Core Data
Generated my NSManagedObject subclass+extension (while codegen: ClassDefinition)
I accidentally saved the generated classes in the Wrong folder
I deleted the generated files
Re-generated in folder I wanted
đź’Ą- Xcode used twice errors
As others have posted I kept cleaning my build (and clean build folder) but that never fixed the build issue.
I finally figured out if you originally created your NSManagedObject generated classes with codegen: ClassDefinition, as I did without knowing then you are locked in for the chicken and egg issue.
I then deleted the auto generated classes thinking I had to re-generate, so I did. Once re-generated I would get the used twice build error again. I manually went into the ../DerivedSources/CoreDataGenerated/Model/.. and deleted the duplicates. Again, I re-generated thinking I'd only have 1 copy (in my project) but I was wrong. If codegen: ClassDefinition was originally set then Xcode will keep creating the auto-generated classes+extensions and put them in the buried folder ../DerivedSources/CoreDataGenerated/Model/... I repeated this chicken and egg a few times before catching on.
I later realized you do indeed need to mark codegen: Manual/None however to get things back in sync you need to delete the auto-generated files in ../DerivedSources/CoreDataGenerated/Model/.. and in your project if you have any there still.
Be careful setting codegen: Manual/None, for me it was bit tricky because codegen: Manual/None wouldn't stick. I had to click back and forth between entities multiple times to double/triple check each entity was set to codegen: Manual/None. Then auto generate the files. At this point your only copy of the auto generated files should be in your project and not in ../DerivedSources/CoreDataGenerated/Model/...
Last, I think this is a bug because if you specify codegen: Manual/None I don't expect Xcode to auto generate files at all, yet it does and puts them in your project. More confusing if your setting is codegen: ClassDefinition, who the heck knows Xcode will put the files in a buried directory yet it is available for use in your project. My beef with this is the auto generated files aren't source controlled and if I change computer I have to know to auto-generate them on the new station.
Hope this helps someone else!
Cheers!
This is indeed not a bug. As #Morrowless suggests both class definition and properties extension are created. If this is not wanted, select Manual/None under Codegen before generating the code. If the code is already generated, just delete them, and try Editor->Create NSManagedObject Subclass... again from the menu (after setting Manual/None).
Note, in the picture below, the Class Name 'Contact' is specific to my project. You will see your entity name instead.
If you generated CoreData subclasses with codegen: ClassDefinition your basically screwed. The only way to fix it is to:
Delete your CoreData subclasses.
Delete your derived data folder.
Clean your project (CMD+K).
Generate new CoreData subclasses, this time select Codegen: Manual/None and Module: Current Product Module
This is not a bug. Codegen generates these files in the DerivedData folder, so you don't need to create them again in your project, hence the compile error.
From Xcode 8.0 Release notes:
Xcode automatically generates classes or class extensions for the entities and properties in a Core Data data model. Automatic code generation is enabled and disabled on an entity by entity basis, and is enabled for all entities in new models that use the Xcode 8 file format. This feature is available for any data model that has been upgraded to the Xcode 8 format. You specify whether Xcode generates Swift or Objective-C code for a data model using the data model’s file inspector.
When automatic code generation is enabled for an entity, Xcode creates
either a class or class extension for the entity as specified in the
entity's inspector: the specified class name is used and the sources
are placed in the project’s Derived Data. For both Swift and
Objective-C, these classes are directly usable from the project’s
code. For Objective-C, an additional header file is created for all
generated entities in your model. The header file name conforms to the
naming convention “DataModelName+CoreDataModel.h”.
However, if you selected Category/Extension under the codegen pulldown menu in the data model inspector (because you want to add logic to your model): codegen will wrongly generate both the class definition and properties extension.
The solution is to simply delete the properties extension (ClassName+CoreDataProperties.swift). Your project should now compile.
After following the guidance from oyalhi and Vladimir Shutyuk, (deleting the NSManagedObject files, changing the entity codegen to Manual/None), I had to restart Xcode to allow it to index again before I could re-generate the NSManagedObject files and get a successful compile.
For the sake of completeness..:
I just ran into the same error, but none of the proposed solutions worked. What puzzled me was that even switching from automated code generation to manual for the one (as I thought) problematic entity didn't do anything.
Finally, I figured out that I had several entities with the same name, but they all shared the same classname. The reason for this was that I copy&pasted one entity several times to save me some work, because they also have a few attributes in common.
Turns out XCode renames the duplicates by adding 1, 2,... to the entity name, but leaves the class name as before. And since now entity name and class name are "unrelated", renaming the entity won't change the class name either.
Hope it helps someone - I have also filed a bug report for this.

How to make SubSonic 3.0 generate .cs files for each class/table instead instead of single ActiveRecord.cs

I have been using SubSonic 2 on several projects before but with the new SubSonic 3 I have implemented in 2 projects. However, my question has always been is if I can change the the output T4 template to generate a class file for each table instead of single ActiveRecord.cs file. I want to use it in a very large project and I can see where is not practical to have 80+ tables in a single file. I prefer to have separate class files.
Would I need to change SubSonic.Core?
If its not possible, please let me know.
Thanks
Why does it matter how many files there are if the code is entirely generated? What practical difference is there?
You can change the templates to output multiple files. No changes would be required to the SubSonic dll, just the T4 Templates.
However, I fail to see how it is worth even just the time to post the question here, much less the time required to actually make those changes.
There is a way to do this, if you rewrite the T4s to follow this example. However, I think there is an issue that may arise when you drop a table, the previously created .cs file for that table will not be removed. I think you would have to further edit the T4 to start by deleting all its previously generated files.

CruiseControl.Net 1.5, htmlReportPlugin, how to make/keep build-specific copies of the html-files?

I'm using NCover 3.4 (current as of 2010-06-16) to create html reports, which I wish to link to from CCNet.
This article explains how,
http://csut017.wordpress.com/2009/05/29/improved-ncover-integration/
but my build-specific report is not stored in a way that is expected in article(?). At least it does not work for me.
I guess the question is - given a directory with files, how do I get them included in my build-log?
I get reports generated in ./src/coverage/FullCoverageReport during the build.
When I click my report link in dashboard
()
I get
[6:WARN] Unable to find file '74\coverage\FullCoverageReport\fullcoveragereport.html' in 'HealthMonitor'
We abandoned using NCover 3.4 and use NCover 1.5.8 instead. It produces the desired reports in xml, hence the need for html inclusion is no longer there...

What information about me and my system do compilers add to executeables?

I'm currently using Microsoft Visual Studio 2010.
If we say that we give 10 different people a copy of MSVC 10 and a short C++ Hello, World listing. They all create a new project using exactly the same settings, add a new cpp file with the Hello, World program and compile it.
Do they all get the exactly same binary?
If not, what are the exact differences?
What information about my system does MSVC add to my executeable?
Paranoia!
If you each create a project from scratch you'll at least get different GUIDs assuming it's the type of project that needs GUIDs. The GUID is set at the time you create the project so if one of you creates the project and then you share the project there will be no difference in the binaries. There is no identifiable info in the GUIDs AFAIK.
Just can't help to respond even though the question is more than a year old.
Apart from what was already mentioned (source paths & guid), there is also a structure present in most Portable Executable file known as the Rich Header.
More detailed info can be found at the following links:
http://ntcore.com/files/richsign.htm
http://web17.webbpro.de/index.php?page=microsofts-rich-header
As far as I know you would get the exact same binary...

Use subsonic 3.0 to work with stored procedures

Hi I just downloaded subsonic 3.0 and I want to work with stored procedures. I don't know which template to choose: ActiveRecord or LinqTemplates. I don't really know the difference. I know that I don't want to deal with Linq code. I just want subsonic to generate classes based on tables and also their relationships (if possible) and generate code to interface with stored procedures.
I couldn't find a lot of info on the subsonicproject site. I don't know which template folder to drag into my project, and which _settings.tt file to change. Under the T4 templates, there are four folders: ActiveRecord, LinqTemplates, SubSonic.TemplatesVB, TemplateProviders. I don't know which one to deal with for my situation. Can somebody post step by step instructions please, or point me to a page that already does?
Thanks
I'm currently using the Activerecord template, wich generates a class with every stored procedure in the database. The settings.tt files depend on wich database you're working (SQL Server, SQLite, MySQL..) There is a straightforward instruction to configure the Activerecord templates: http://subsonicproject.com/docs/Using_ActiveRecord

Resources