Comments (5)
Sure, I'll leave it open for the time being. 👍
from facil.
Can you ping me privately - Twitter or some DM solution (email?) - if you're interested, it might be good to jump on a quick call to talk about things.
from facil.
Sounds like a simple thing to implement! But given your issue, it also kinda sounds like I would be implementing a foot-gun, or at least something that does not push you into the "pit of success". So I'd like to understand your issue a bit more first.
If I am understanding you correctly, the "Build" project sets up the database, and the "Main" project contains the Facil-generated stuff, and "Build" references "Main". This seems like a bad idea, as it gives the issue you describe. This is a cyclic dependency: Facil depends on the DB which depends on the code generated by Facil. Since you're an F# dev, I'm sure I don't have to tell you that cyclic dependencies are evil. Moreover, it's an unnecessary cyclic dependency: If it were actually necessary, it would of course be impossible to ever build the project.
I of course have very limited information to go on regarding your code, but given what little I can infer, I would strongly recommend you to refactor to remove the cyclic dependency. There seems to be no reason why the Facil-generated code that uses a DB should be a dependency of the code that sets up the DB. If you disagree, I am guessing Facil is generating code from multiple DBs, and can be split into multiple projects.
For the record, I always have a dedicated project for Facil-generated code (which I usually just call "DbGen"). This gives the following benefits:
- No weird dependencies; the only reason to reference the project is to use the Facil-generated code.
- Improved compilation times, since the Facil-generated code (which may be sizable) does not need to be re-compiled whenever something else changes.
- I can have a project file like this, which automatically picks up new SQL scripts, changes to SQL scripts and Facil config, etc.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="SQL\**\*.sql" />
<None Include="facil.yaml" />
<Compile Include="*.fs" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Include="SQL\**\*.sql" />
<UpToDateCheckInput Include="facil.yaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Facil" Version="2.5.7" />
<PackageReference Update="FSharp.Core" Version="6.0.6" />
</ItemGroup>
</Project>
Should probably officially document this somewhere...
In any case: I have probably spent longer just writing this than I would have spent implementing the flag you request, but I really want to make sure that it's not a bad idea, and right now I think it may be, since it may push developers out of the "pit of success".
from facil.
Hi @cmeeren and thanks for the detailed reply :-) And yes, we know that this is not an ideal place to be in. The reason for it is that the build project is also used not just for standard CI build but for some automation and ad-hoc operational business tasks that use types and functions from the "main" project. I'm hoping that we can move away from this approach in the short/medium term.
Splitting the Facil related code into its own project sounds like a really good idea and might work around the issue we're seeing here anyway, so we'll give that a try - thanks.
Would you mind leaving this issue open for discussion (or closing it and moving to a dedicated Discussion in the repo?).
from facil.
I'm closing this issue since I think it is best solved by the tips I have provided, but feel free to continue discussion. I will re-open if I am convinced that something needs to be changed in Facil.
from facil.
Related Issues (20)
- sql transaction control HOT 3
- Prefixing the sql object names with the database name in the generated sql HOT 1
- Facil strips off additional sql statements from temp table script HOT 8
- Question (not an issue) re: SqlDataReader - getting fields values by field ordinal number vs by field name HOT 3
- Is it possible to execute only a SqlBulkCopy for a temp table without triggering any other operation? HOT 1
- Error loading temp table data within a sql transaction HOT 13
- Runtime exception running console app with Facil 2.2.0 HOT 3
- facil and teams with more than one developer HOT 4
- re: same temp table shared by two stored procedures HOT 2
- Support geography and geometry types
- Support SqlHierarchyId
- Version 2.3.1 raising error when using connectionString: $([Variable Name]) HOT 8
- Facil generator fails when stored procedure contains merge statement (odd issue) HOT 6
- Allow developers to specify the test sql statement used to infer the structure of the resultset returned when standard procs don't work HOT 8
- Upgrade to Microsoft.Extensions.Configuration 6.0.1 breaks environment variable reading HOT 4
- multiple tables without primary keys? HOT 3
- Support DateOnly type. HOT 1
- sysdiagram and related SPs are not excluded by default HOT 11
- InsertBatch temp table case insensitive column names cases HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facil.