code-generation

Generating simple CRUD stored procs

廉价感情. 提交于 2019-12-06 06:38:56
I'm working on a project that is subject to certain corporate standards relating to SQL implementation. Specifically, that all SQL Server content be accessed only via stored proc. (No ORM or LINQ.) 80% or more of our needs can be handled through the basic CRUD (CREATE, READ, UPDATE, DELETE) type of procedure that should be fairly simple to generate. However, I've been unsuccessful so far in locating an existing tool that will generate these fairly simple "base" stored procedures. So, can anyone point me to a tool that I can use to generate the bulk of my required procedures? Preferably one

Page generation from PHP class

▼魔方 西西 提交于 2019-12-06 06:31:29
问题 I'm actually creating websites for fun and some of my friends told me that I could be more efficient if I could create the output of the page with a php class that would represent the whole page. I was wondering how you people would do it. Thanks 回答1: I'd suggest looking into some PHP frameworks, such as Cake which is good for beginners, or Symfony or Zend Framework if you're more skilled. Those will streamline your PHP development a lot. 回答2: I am not a OO programmer .. but, as a proof of

Benefits and drawbacks of generated C# classes for Json objects

浪子不回头ぞ 提交于 2019-12-06 05:55:49
问题 I have sample Json and I need to serialize it into C# objects. I decided to leverage for this purpose Json.Net library. Also I need to have C# classes which will represent this Json. To create classes could be used Json C# class generator. There we have two options. "Create properties" and generated classes will look like: public class Address { private JObject __jobject; public Address(JObject obj) { this.__jobject = obj; } public string street_address { get { return JsonClassHelper

How best to deal with gigantic source code files in Visual Studio

会有一股神秘感。 提交于 2019-12-06 05:35:22
问题 I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so. Splitting them out into partial classes/separate files isn't an option in the immediate term, though it may be later. Are there any clever IDE tricks to dealing with this? EDIT: so people are immediately saying (very sensibly) 'don't have a file that

How to use Slick code generator to include database views as well?

蓝咒 提交于 2019-12-06 04:43:15
问题 I'm trying to generate the Scala code for the database tables and views in my schema using Slick 3.0.3. Taking this blog as example I have the following file build.sbt . However, this will generate code for my database tables and will not include the database views. How can I get the views generated as well? According to slick issue 1022 I see it is possible to do but the API doesn't look alike and slick.codegen.SourceCodeGenerator doesn't have a getTables or defaultTables to include view

Code generating JUnit based on Abstract Syntax tree walk

坚强是说给别人听的谎言 提交于 2019-12-06 04:20:20
Assuming I have the following class and method: package generation; class HelloWorld { public boolean isEven(int val) { if ( (val % 2) == 0) return true; else return false; } } Assume I want to generated the following JUnit test: package generation; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class HelloWorldTest { @Test public void testIsEven() { HelloWorld h = new HelloWorld(); assertTrue(h.isEven(2)); assertFalse(h.isEven(1)); } } Given the following method of tree walking a Java Syntax Tree: How can I use the java

Compile time check if a function is used/unused c++

旧城冷巷雨未停 提交于 2019-12-06 03:57:09
问题 I'd like to check during compile time if some function of some class is used/not used, and accordingly fail/pass the compilation process. For example if function F1 is called somewhere in the code I want the compilation to succeed, and if function F2 is called I want it to fail. Any ideas on how to do that, with usage of preprocessor, templates or any other c++ metaprogramming technique? 回答1: You can achieve this with a c++11 compiler provided you are willing to modify F2 to include a static

Anyone have experience calling Rake from MSBuild for code gen and other benefits? How did it go? What are your thoughts / recommendations?

核能气质少年 提交于 2019-12-06 03:50:13
问题 While programming in C# using Visual Studio 2008, I often wish for "automatic" code generation. If possible, I'd like to achieve it by making my MSBuild solution file call out to Rake, which would call Ruby code for the code generation, having the resulting generated files automatically appear in my solution. Here's one business example (of many possible examples I could name) where this kind of automatic code generation would be helpful. In a recent project I had an interface with some

Visual Studio custom tool for code generation… how do I find out what's going wrong?

ぐ巨炮叔叔 提交于 2019-12-06 03:46:45
问题 I'm trying to create a custom tool for code generation in Visual Studio 2010. First I register it: "$(FrameworkSDKDir)Bin\NETFX 4.0 Tools\gacutil.exe" /if "$(TargetPath)" Then I add it via a reg key: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{6A96476E-74F3-4AB3-9CCA-F15EC6104D84}] "RuntimeVersion"="v4.0.30319" "Class"="MapBuildTool.MapFileGenerator" "Assembly"="MapBuildTool, Version=1.0.0.0, Culture=en-US, PublicKeyToken=7d8abca94a1e38ae" "ThreadingModel"=

Set null to target using mastruct

痴心易碎 提交于 2019-12-06 03:45:29
I am using mapstruct and I am wondering if there are any ways to set null value for some target properties. For example, public class MySource { private String prop1; private String prop2; public MySource() { // Initialization. } // Getters - Setters. } public class MySourceDto { private String prop1; private String prop2; public MySourceDto() { // Initialization. } // Getters - Setters. } @Mapper public interface MySourceMapper { @Mappings({ @Mapping(target = "prop1", propertyToSetNull = null)}) public MySourceDto toView(MySource mySource); } I would love the above source, dto and mapper to